I'm working on an Anrdoid app. It's almost finished. I've just noticed that the minSdkVersion
is set to 21. Maybe I forgot it when I created the project. I'd like to lower it, because the app's users will likely to have older devices.
I don't think it's good idea to change the minSdkVersion
to ~10, sit back, and hope it will compile and run fine in the future.
My idea was that I could check all the methods used in the project, their minimum API level, so I could know what I have to replace with alternatives. However, the project is a bit large. Searching for all methods' documentation one by one would take a lot of time.
Is it possible to automatically list the Android API specific methods used in my project, and their API level? Or somehow detect the highest API level that is required by an used method? Android Studio knows these numbers, it can fetch the documentation too. Or, is it safe to change the minSdkVersion
and targetSdkVersion
to a lower API level to know which methods aren't supported in an older device, and after I fix all errors/warnings the IDE will show me, will my app run fine?
Android Studio will give you warnings when you use methods that require a higher sdk version than your specified minSdkVersion
. You can access the whole list of these warnings for the complete project by leveraging the Analyze -> Code Cleanup functionality. So what you can do:
minSdkVersion
.By trying different version numbers you can see how many changes are necessary. To decide for the correct minSdkVersion
, you might want to consider the Android API level device stats.
So a strategy for deciding for a targetSdkVersion
or minSdkVersion
typically looks like this: You set the targetSdkVersion
to the highest version number that you have tested your app with. The minSdkVersion
should be set to a lower value - low enough so enough devices are supported, but high enough so there are not to many version specific workarounds necessary. Find details about these two values in the Android documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With