Skip to content Skip to sidebar Skip to footer

Instant App Installable App With Different Min Sdk Levels

my android project min sdk level is 16. I want to turn it into instant app but I need to maintain min sdk level but instant app supports min 23. I tried to set different api levels

Solution 1:

Another way to do this so that the instant app APKs have the desired minSdkVersion is with this:

App (com.android.instant.application) manifest:

<uses-sdktools:overrideLibrary="com.example.feature"/>

App (com.android.instant.application) gradle:

minSdkVersion rootProject.minSdk

Feature (com.android.instant.feature) gradle:

minSdkVersion rootProject.minSdkInstant

This allowed me to build

  • Installed app with minSdk
  • Instant app APKs with minSdkInstant

The only recommended way is to use flavors.

Besides the tools:overrideLibrary method, there are no other ways to do this.

The APKs are generated from the feature plugin and not from the instant App plugin.

Can you check android-instant-apps/configuration-apks/features/build.gradle and this SO Question

Solution 2:

The only way I've been able to do this is by using different product flavors. For example:

    instant {
        dimension "delivery"
        minSdkVersion 23
    }
    installed {
        dimension "delivery"
    }

Note you can have multiple dimensions defined (for example I have flavorDimensions "app_type", "delivery")

Solution 3:

You can also refer this AIA minSdkVersion bug for details on your query, with recommended way to use flavors. Quoting the details shared on the link:

Another way to do this so that the instant app APKs have the desired minSdkVersion is with this:

App (com.android.application) manifest:

App (com.android.application) gradle: minSdkVersion rootProject.minSdk

Feature (com.android.feature) gradle: minSdkVersion rootProject.minSdkInstant

This allowed me to build - installed app with minSdk - instant app APKs with minSdkInstant

Also refer this link for information on flavor dimensions.

Post a Comment for "Instant App Installable App With Different Min Sdk Levels"