I have an app available for android on google play
I'm willing to make it runnable for api level >= 15
One of the apis I use in my app is crashing on api level < 20, so in order to make it run fine i need to import a third API (only for those versions, it looks like android has included the required components in newer versions)
How can a build an apk and tell google play to use this apk (larger since it includes more apis) only for api level < 20 and still use the other one for the newer version?
If I get it right you need multiple APKs for different API levels
This is the relevant Google documentation for that https://developer.android.com/training/multiple-apks/api
This done with the use of minSdkVersion and maxSdkVersion
ie.
- "older support" you can use minSdkVersion = 15 and maxSdkVersion = 19
- for newer APIs minSdkVersion = 20 without defining any max version.
Then you have to use different Version code in these apps with a sophistigated pattern for application versioning:
Check here the Using a version code scheme
eg.
Related
I have users and showing ads from Android API Level 16. However, Google Mobile Ads SDK 21 requires a minimum Android API level of 19. How can I target the users of API Level 18 or earlier?
dependencies {
implementation 'com.google.android.gms:play-services-ads:21.0.0'
}
You can't use the latest AdMob SDK on devices below API 19.
The minimum supported SDK by Admob 21.0.10 is now 19.
You can either set your app to use minSdkVersion 19 or use AdMob's older SDK version i.e 20.6.0.
Of course there is a a way: flavours
You'll have to manage and build two apps basically. One "old" version and a new one. The difference will only be the dependencies and the specific class, that uses this dependencie. You will create 2 versions of that class. the rest stays the same. In the end you wil have to compile two APK and ship two APKs.
Google Play store will accept both and hand out the "old" version to old phones and the "new" version to new phones.
This is a bit complex and time cosnuming and all depends if it's worth it for your specific use case. It works great and Android Studio let's you swap between the two code bases very easily.
From here and here Google says "Make sure that your third-party SDK dependencies support API 29".
However, Google doesn't say what happens if third-party libraries don't target API 29. For example, greenDAO targets API 25. It's not clear to me what happens if my app targets 29, but greenDAO targets 25 - is this resolved somehow?
I'm assuming that so long as my app targets API 29, it will continue to auto-update, because this is the current state of the world: Play store currently requires at least API 28, and my app auto-updates even with third party targets targeting less than API 28.
I found the following topics, but they weren't comprehensive.
Dependencies in the app to fulfil the API Target 26 in Aug/Nov 2018
https://www.reddit.com/r/androiddev/comments/8wxuci/questions_about_3rd_party_libraries_targeting_api/
Recently I read a book about android which says that Starting with august 2019, Google play will only accept apps built using Api 26 or newer. But recently we published android app that has minimum Api level 23 and it is successfully published. Can anyone tell whats the scenario, or the documentation in the book is wrong?
They are not talking about minSdk , they are talking about targetSdk or compileSdk.
Notice that I used "or" because your targetSdk can not be higher than your compileSdk.
When you increment targetSdk number, you have to comply with the new api and rules enforced however using an old compile/target sdk will let you use the features in the same way as they worked in earlier versions (which is one of the root causes of security vulnerablities). That is why they placed the restriction so every app is forced to use 'new way of doing things' rather than old.
For example, Before Android 5.0, permissions were granted when app was installed but then it was changed so now you have to ask permissions on runtime. If you target Sdk api lower than Android 5.0, you don't have to do anything and it will work on newer devices as well. However, if you target api higher than Android 5, you must ask for permissions on runtime or the newer sdk code throws an exception.
What this means is that your target API has to be their minimum (in this case 28), but you can still set your own minimum API to whatever you want to allow backwards compatibility.
When you upload an APK, it needs to meet Google Play’s target API level requirements. Starting August 1, 2019, Google Play requires that new apps target at least Android 9.0 (API level 28), and that app updates target Android 9.0 from November 1, 2019. Until these dates, new apps and app updates must target at least Android 8.0 (API level 26).
https://developer.android.com/distribute/best-practices/develop/target-sdk
I have an app that targets 28, but the min API level I want is 18. It still allows me to upload the app because it targets 28.
It means that you have to set in the build.gradle file
targetSdkVersion 28 //or later
Official doc:
When you upload an APK, it needs to meet Google Play’s target API level requirements. Starting August 1, 2019, Google Play requires that new apps target at least Android 9.0 (API level 28), and that app updates target Android 9.0 from November 1, 2019. Until these dates, new apps and app updates must target at least Android 8.0 (API level 26).
Keep in mind that:
minSdkVersion <= targetSdkVersion <= compileSdkVersion
If you want to have more details about minSdk, targetSdk and compileSdk I suggest you reading this blog.
I want to upgrade my project to api level 27 from api level 25. I used plenty of third party library like RxJava, Exoplayer , dagger etc.
RxJava version used in my project is 1.x.x not 2.x.x. So I have following questions
If I am upgrading gradle with current api level, whether other third party library need to be upgraded to target api level 27 ?
If yes. there are several library which still using 24 or 23 targete api and no update available so for. Is there is any issue using this ?
Meet Google Play's target API level requirement document say all apk from November need to target api level 26 details. So this applies to third party library too ?
Suppose I am using some image crop library having targeted version 23. In that case will my apk get rejected from google play store ?
If I am upgrading gradle with current api level, whether other third
party library need to be upgraded to target api level 27 ?
I don't think you'll need to upgrade those third-parties libraries because it's out of your hands I'd say and that's all depends on the developer. But, it should work fine i suppose. Also, you may wanna consider using the latest version for libraries when updated the API to 27.
If yes. there are several library which still using 24 or 23 targete
api and no update available so for. Is there is any issue using this
?
It might just cause some issues(not working, not compatible or ...) because of new API on Android itself(behavior or etc) using newer versions but, there will be new updates of course and mostly, most of them works in my side.
Meet Google Play's target API level requirement document say all apk
from November need to target api level 26 details. So this applies to
third party library too ? Suppose I am using some image crop library
having targeted version 23. In that case will my apk get rejected from
google play store ?
The answer to this question is "Perhaps". I mean, if they said it should be at least supporting v26 APIs, so, some libraries might not work (Depreciated codes-methods)on the new APIs and might Google recognize that and your app won't be accepted so, you may wanna update as they just said and reconsidering targeted APIs with libraries which supports the targeted API +.
This is a beginner question, but what are the steps needed to get my app to run on more devices? I noticed that my new update (on beta) is running on fewer devices. Do I just need to update the targetminsdk version in build gradle or is there anything else I need to do? I think I should be aiming for minsdkversion 18?
My versions in gradle are here
compileSdkVersion 23
minSdkVersion 21
targetSdkVersion 22
Min sdk version : Is the earliest release of the Android SDK that your application can run on. So this is what you want to change if you want more devices supported for your app.
Target sdk version : The version your application was targeted to run on. Ideally this is because of some sort of optimal run conditions.
Android Developers forum says :
The dashboard for Platform Versions is updated regularly to show the distribution of active devices running each version of Android, based
on the number of devices that visit the Google Play Store. Generally,
it’s a good practice to support about 90% of the active devices, while
targeting your app to the latest version.
For more details, go through : Supporting Different Platform Versions
For API 18 : your app will run on approximately 76.9% of the devices that are active on Google Play Store.
For API 21 : your app will run on approximately 40.5% of the devices that are active on Google Play Store.
Now that is a huge difference, that you may not really want for your app. So you need to weigh your pros and cons of having Latest API support to getting more users. I would infact recommend you to go for API 18 instead of 21, unless you have some very important functionality that necessitates API 21 and above and can't be done without.