简体   繁体   中英

Using maxSdkVersion for light version of an app

I'm facing [LinearAlloc exceeded capacity][1] error when I try to install our app on devices running Gingerbread. So we decided to break our app in two versions: a light one with just some of our features (targeting API 8+) and another one one with our full features (targeting minSdkVersion=11).

My question is: should I set the light version with maxSdkVersion=10 in this case? The problem is that the developer guide highly recommends to avoid using this property. But I also would like the user to see only the best version of our app for his device.

Our project is really complex and the performance on old devices is becoming bad.

I've found some workarounds for this error but all of them uses Ant, and we've already moved to Gradle. And we still have a considerable number of Gingerbread users, we must consider them.

Is this approach ok?

The downside to adding the maxSdkVersion is that should the device get upgraded in the future your app would be removed in the process.

You have to wonder if someone would bother upgrading a 2-3 year old device though or if there is even an update available.

However, to cover all scenarios you could simply add a check in the "light" version that notifies the user that they can install the full app on a device with SDK >= 11. You could also link to it directly in Google Play.

You may try bringing multiple APK support to your app.

http://developer.android.com/google/play/publishing/multiple-apks.html#HowItWorks

The answer to your question

Should I set the light version with maxSdkVersion=10 in this case?

is here:

You should avoid using android:maxSdkVersion in general, because as long as you've properly developed your application with public APIs, it is always compatible with future versions of Android. If you want to publish a different APK for higher API levels, you still do not need to specify the maximum version, because if the android:minSdkVersion is "4" in one APK and "8" in another, devices that support API level 8 or higher will always receive the second APK (because it's version code is higher, as per the previous note).

So differentiating your APKs in their manifests by only specifying different android:minSdkVersion values should be enough.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM