Home » Android » android – minSdk != deviceSdk

android – minSdk != deviceSdk

Posted by: admin June 16, 2020 Leave a comment

Questions:

Hi guys just recently started getting into Android development. I feel this is a very stupid question but I’ll shoot anyway since I’ve spent an hour on this already. I am currently trying to run a project on my device, with no changes to what Android Studio gave me. I think this image should describe my problem better:

enter image description here

When running I get Failure [INSTALL_FAILED_OLDER_SDK].

I can’t understand why they are not compatible. Rather, why does minSdk say API 20 when minSdkVersion on build.gradle says 15? I’ve tried adding uses-sdk on manifest.xml but I figured that would be unnecessary since my build.gradle file will overwrite that (it didn’t work also).

Am I missing some kind of setting here?

How to&Answers:

For some reason, using ‘L’ as the targetSdkVersion makes it so the minSdkVersion is ignored. You should set the targetSdkVersion to something other than L.

Answer:

It’s not a bug. It’s a feature :).

If you compile against a preview platform, you can only run on a
preview platform.

You should set targetSdkVersion and compileSdkVersion to API 19.

You can read more about this problem here:

Issue 72617: Android Studio Compatible: No, minSdk(API 20, Lpreview) != deviceSdk(API 19)

Issue 72453: Setting sdkCompileVersion to ‘android-L’ creates an apk with ‘L’ as minSdk regardless of a lower minSdkVersion value