How can I target Android API 27 (Oreo 8.1) ?

After my main test device updated to Oreo 8.1, the most basic Android project built with VS for Mac 7.3.2 now won't run on my phone. It does run on an emulator with an Android API27 image, but not on the hardware. I suspect it is because I cannot target Oreo 8.1 in my project's build settings. I have used the built-in SDK manager to download Android SDK Platform 27, but it is not available in the dropdown on the project's build settings.
Has anyone had success in using the latest stable Visual Studio for Mac to build an Android app that can run on Oreo 8.1 devices?

My device is a Google Nexus 5X and my tool stack looks like this:

=== Visual Studio Community 2017 for Mac ===

Version 7.3.2 (build 12)
Installation UUID: 516e4b9d-e76b-4eab-9a24-2f2181ee3bfa
Runtime:
    Mono 5.4.1.7 (2017-06/e66d9abbb27) (64-bit)
    GTK+ 2.24.23 (Raleigh theme)

    Package version: 504010007


=== Xamarin.Android ===

Version: 8.1.0.25 (Visual Studio Community)
Android SDK: /Users/jannie/Library/Developer/Xamarin/android-sdk-macosx
    Supported Android versions:
        4.0.3 (API level 15)
        4.1   (API level 16)
        4.4   (API level 19)
        5.1   (API level 22)
        6.0   (API level 23)
        7.0   (API level 24)
        7.1   (API level 25)
        8.0   (API level 26)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 27.0.1
SDK Build Tools Version: 23.0.1

Best Answer

Answers

  • JannieTheunissenJannieTheunissen GBMember ✭✭

    When I updated the build tools I got more useful error messages in my debug console:

    [monodroid] cannot find libmonosgen-2.0.so in ... nor in previously printed locations.
    [monodroid] Do you have a shared runtime build of your app with AndroidManifest.xml android:minSdkVersion < 10 while running on a 64-bit Android 5.0 target? This combination is not supported.
    [monodroid] Please either set android:minSdkVersion >= 10 or use a build without the shared runtime (like default Release configuration).

    Since my minimum SdkVersion was already at 16, I disabled the shared runtime as suggested and I'm back in business.

    Thanks Jorge!

  • _xamarinDeveloper_xamarinDeveloper USMember ✭✭

    Hi guys,

    I have the same problem. I have an app on play store. And when I download and open on Google Pixel 2 XL (Oreo 8.1) the app crashes on its start up.
    I have tested the app in an emulator with Oreo 8.0 and it works quite well.

    Can I suggest to me any solution for my app?
    Should I update the target api or something?

    Thanks,
    Regards

  • batmacibatmaci DEMember ✭✭✭✭✭

    @_xamarinDeveloper said:
    Hi guys,

    I have the same problem. I have an app on play store. And when I download and open on Google Pixel 2 XL (Oreo 8.1) the app crashes on its start up.
    I have tested the app in an emulator with Oreo 8.0 and it works quite well.

    Can I suggest to me any solution for my app?
    Should I update the target api or something?

    Thanks,
    Regards

    Did you find anything about this issue?

  • batmacibatmaci DEMember ✭✭✭✭✭

    @JorgeRamirez said:
    I think you might want to update your Android SDK build tools. I can run my Android apps fine on my Pixel 2. My Xamarin Android stack versions is:

    Xamarin.Android
    Version: 8.1.0.25 (Visual Studio Community)
    Android SDK: /Users/jorgeramirez/Library/Developer/Xamarin/android-sdk-macosx
    Supported Android versions:
    4.4 (API level 19)
    4.4.87 (API level 20)
    5.0 (API level 21)
    5.1 (API level 22)
    6.0 (API level 23)
    7.0 (API level 24)
    7.1 (API level 25)
    8.0 (API level 26)

    SDK Tools Version: 25.2.5
    SDK Platform Tools Version: 27.0.1
    SDK Build Tools Version: 27.0.3 <---- Yours is 23.0.1

    Perhaps if you match these versions, it should work for you! :smile:

    I have all the same installed but my VS 2017 pro doesnt show 8.1 as an option

  • JorgeRamirezJorgeRamirez CAUniversity ✭✭

    Hello @batmaci

    Have you tried running a blank project? Is it a Xamarin.Forms project? I'm having similar issues of crashing on startup to new devices, something must be with the framework, but its not happening on my Pixel 2.

    In your MainActivity, is it extending from FormsApplicationActivity or FormsAppCompatActivity? I've seen crash on startup with one or the other, you could try changing that.

  • _xamarinDeveloper_xamarinDeveloper USMember ✭✭

    @batmaci said:

    @_xamarinDeveloper said:
    Hi guys,

    I have the same problem. I have an app on play store. And when I download and open on Google Pixel 2 XL (Oreo 8.1) the app crashes on its start up.
    I have tested the app in an emulator with Oreo 8.0 and it works quite well.

    Can I suggest to me any solution for my app?
    Should I update the target api or something?

    Thanks,
    Regards

    Did you find anything about this issue?

    I did not found any solution yet. I will try it if anything works.

  • _xamarinDeveloper_xamarinDeveloper USMember ✭✭

    @JorgeRamirez said:
    Hello @batmaci

    Have you tried running a blank project? Is it a Xamarin.Forms project? I'm having similar issues of crashing on startup to new devices, something must be with the framework, but its not happening on my Pixel 2.

    In your MainActivity, is it extending from FormsApplicationActivity or FormsAppCompatActivity? I've seen crash on startup with one or the other, you could try changing that.

    Thanks for your response. Yes it is Xamarin Forms app. I tried to run a blank app and still I don't access the 8.1 api on emulators. In my MainActivity it is extending from XFormsApplicationDroid.

  • MauricioEstradaMauricioEstrada USMember
    edited March 14

    Hello everyone,

    in my case, I worked installing Java JDK 9.0.4 and installing the SKD Tools of the attached image.
    Regards!

  • ShawnZhengShawnZheng USMember ✭✭

    I have same problems and it happened when minimum android version >= 26. if minimum Android version number is lower 26 than it is OK but Google play store policy changed to minimum Android version number >= 26. any one found solution?

Sign In or Register to comment.