Search code examples
androidversions

Android:Can I have diff versions of my app for various versions of devices


My app shows some problem in devices less than 3.0. Can I have another version (say 1.1) which supports devices less than 3.0 but if I download my app from device with versions greater than 3.0 I should not get 1.1 . How to Implement it?

Thanks in advance.


Solution

  • Yes, you can.

    You first need to switch your Google Play developer console to "advanced mode" using the button in the upper right corner of the console.

    Then you upload a second APK that has a different minSdkVersion defined and activate it. You will then have two APKs active, each supporting a different minSdkVersion. Devices will choose the APK with the highest compatible minimum version.

    Note that each APK also needs a unique version code.

    For more information, see the Multiple APK Support documentation.

    If there are only minor differences in the code between versions, you might also want to consider going the simpler route of branching your code for different versions like so:

    if (android.os.Build.VERSION.SDK_INT >= 11) {
        // API 11+ behavior
    } else {
        // API < 11 behavior
    }