Home » Android » xamarin.forms – Xamarin Forms Android Target API level Warning

xamarin.forms – Xamarin Forms Android Target API level Warning

Posted by: admin June 15, 2020 Leave a comment

Questions:

for the last days, whenever I deploy a new Xamarin Forms app to Google Play Store, I get the following warning when from Play Store:

Your app currently targets API level 15 and must target at least API
level 26 to ensure it is built on the latest APIs optimised for
security and performance.

From August 2018, new apps must target at least Android 8.0 (API level
26).

From November 2018, app updates must target Android 8.0 (API
level 26).

But Target Android Version is set to “Automatic – user target framework version (API 27)” while Minimum Android version is “Override – Android 4.0.3 (API level 15)”.

I don’t think that from August 2018 onwards, only apps for Android 8 or higher are allowed in the Google Play Store, right? So currently I could of course ignore the warning, but what do I need to change for August?

Many thanks!

How to&Answers:

Counter-intuitively with Xamarin, when you set the target SDK to use the latest version it actually targets the minimum version. You need to set the target SDK to a specific version.

In other words, change from “Automatic” to a specific version.

More info here:

https://github.com/xamarin/xamarin-android/issues/1163

Answer:

The apps will keep working, but you should consider targeting API 26 for the warning not to be shown to your users. It’s a win for all sides: your app is safer, Google is happy and your users don’t see a warning that will make them trust your app less than they otherwise would.

EDIT: you probably know this, but you need to set targetSdkVersion in your build.gradle file to 26 to meet the requirement for the warning not to be shown.

P.S. here (article) you can read more about it.

Answer:

I think something is probably wrong with your build process, and even though you think the target API is 27 it isn’t. You can verify your target API/SDK using the following command:

aapt dump badging my.apk

The target sdk will appear on a line like this

targetSdkVersion:'27'

So you could use a tool like grep to find it quickly.

If aapt gives a result of 26 or 27 and Play store still gives the warning then it is a bug with Play, and you should report it via Play console support. You can contact them via the help menu (the “?” icon) in the Play console.