Errors when changing Android version (Target Framework) in Xamarin Forms

April 15, 2019, at 4:10 PM

I have a C# Xamarin Forms Solution in Visual Studio 2019 that was created from the Xamarin Forms Template.

When the Android version (Target Framework), (found in the 'Application' Tab of the properties Window of the Android project) is set to either

1) Android 8.1 (Oreo)

2) Android 9.0 (Pie)

then my app works great on a phone running Android 9.0

However, as soon as I change it to 'Android 8.0 (Oreo)' then Visual Studio generates errors and warnings. Here is an image of them:

The reason I think I need to change the Android version to 8.0 is so that I can use the app on Android phones with this version. When I try to install the APK file (built targeting either 8.1 or 9.0) on an 8.0 Android device then the app does not work.

The error suggestion to "..increase the $(TargetFrameworkVersion)..." seems odd considering I am trying to target a lower version.

I should point out that I have all the Android SDK's installed for 8.0/8.1/9.0 and all the Android SDK Build Tools.

Please can someone advise me on what I am doing wrong so that I can target Android 8.0 (Oreo) in the hope my app will work with a device of that version.

I am very new to Xamarin, so apologies in advance if I have left out some critical piece of information, or it is something obvious that I have overlooked.

Many thanks in advance for any help.

Answer 1

You only need to change the Minimum Android Version to run on lower API versions. Make Target Android version higher (to version 9) and Minimum Android Version to a version which you would like to support (maybe version 6). Also note that if you have any android support libraries or Xamarin.Forms, those also have a minimum build version. You have to target equal or higher version to build with those. Another thing you have to check is Supported Architectures (Properties-> Android Options -> Advanced -> Supported Architectures). Make sure it checked the architecture of the device that you try to deploy

Keep getting Parse Error launching fileprovider intent

Keep getting Parse Error launching fileprovider intent

I'm trying to launch an update for my app using intent and file provider

How to manage multiple animations on the same widget?

How to manage multiple animations on the same widget?

Is there a best practice or general pattern when it comes to handling multiple animations for a single widget?

How to parcel PagedList<>?

How to parcel PagedList<>?

I've got data class that contains variable of type PagedList?This class needs to implement Parcelable because I want to save its state inside my Bundle

how to get blogger search query results using retrofit [on hold]

how to get blogger search query results using retrofit [on hold]

How to get Blogger search results using a retrofit library using blogger API search URL