Support dynamic delivery solution in SDK

IAPMiniProgram SDK designs a unified module dynamic delivery solution that allows the super app to download and install the required modulesper your requirements to run your application.

For example, in order to enhance the performance and rendering capability of mini programs, MYWeb module/dynamic feature is supported. For example, Google map SDK dynamic integration is supported.

Integration ways

For the following features/modules, you can choose one of the following integrations ways.

Note: It is highly recommended to use the Dynamic integration way.

Integrations way

Description

Static integration

The direct dependency is in the project, which is packaged into the APK along with the project.

Dynamic integration

Based on Google Dynamic Feature capability, download the APK from the Google Play Store when the application is opened. This can reduce the APK size when downloading and improve users' downloading experience.

Static integration

For MYWeb Feature, in the build.gradle file of the project app, add the iapminiprogram-myweb depedency as the following code sample:

Note: Obtain the latest iapminiprogram_version version in the Android Release Notes.

copy
dependencies {
    implementation "com.alipay.plus.android:iapminiprogram-myweb:{iapminiprogram_version}"
}

Dynamic integration

Prerequisite

Make sure the following dynamic module names are used correctly according to the different features:

Feature

Module name

MYWeb feature

mywebdynamicfeature is used.

Google Maps SDK integration

mapdynamicfeatureis used.

Step 1. Create the dynamic module

  1. In your project, click Create new module > Dynamic Feature to start creating a new module. (see the following figure).
  2. Choose the Base Application Module properly.
  3. Fill in the module name correctly according to the different features.
    • For MYWeb feature

image.png

截屏2025-12-29 17.00.18.png

  1. Fill in the Module title according to the different features.
  • By default, "MyWeb Dynamic Feature" is used for MYWeb feature.

image.png

截屏2025-12-29 19.06.11.png

  1. Note: In the Install-time inclusion drop-down list, choose (on-deman only).
  2. Click Finish to finish creating the module.

Step 2. Confirm the correctness of the AndroidManifest file

The default configurations in the AndroidManifest file are generated by the system. You need to check and confirm the correctness of the file.

Note: change the dist:titleaccording to the different features.

Feature

Module name

MYWeb feature

"@string/title_mywebdynamicfeature"

Google Maps SDK integration

"@string/title_mapdynamicfeature"

Code sample:

copy
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:dist="http://schemas.android.com/apk/distribution">

  <dist:module
    dist:instant="false"
    dist:title="@string/title_mywebdynamicfeature">
    <dist:delivery>
      <dist:on-demand />
    </dist:delivery>
    <dist:fusing dist:include="true" />
  </dist:module>
</manifest>

Step 3. Confirm the dynamic repository is imported into the main module

  1. In the build.gradle file of the project app, the system generates the following code by default according to the different features. This is because that you choose the Base Application Module in the previous Step 1.
    • For MYWeb feature
copy
android {
    dynamicFeatures = [':mywebdynamicfeature']
}
copy
android {
    dynamicFeatures = [':mapdynamicfeature']
}
  1. In order to make the dynamic module take effects, must add the following codes in the build.gradle file:
copy
android {
    packagingOptions {
        jniLibs {
            useLegacyPackaging true
        }
    }
}
  1. In the AndroidManifest.xml file of the project app, add the following code according to the different features.
    • For MYWeb feature
copy
<meta-data
  android:name="com.alibaba.griver.dynamic.modules"
  android:value="mywebdynamicfeature" />
copy
<meta-data
  android:name="com.alibaba.griver.dynamic.modules"
  android:value="mapdynamicfeature" />

Step 4. Import the dependency to support the dynamic feature

Import the dependency in the following files:

  1. In the build.gradle file of the project app, add the following codes to import the iapminiprogram-dynamic-feature dependency.
    Note: Check the latest iapminiprogram_version version in the Android Release Notes.
copy
dependencies {
    implementation "com.alipay.plus.android:iapminiprogram-dynamic-feature:${iapminiprogram_version}"
}
  1. In the build.gradle file of the dynamic module, add the following codes according to the different features.
    • For MYWeb feature, import the iapminiprogram-myweb dependency.
copy
dependencies {
    implementation "com.alipay.plus.android:iapminiprogram-myweb:${iapminiprogram_version}"
}
copy
dependencies {
    implementation "com.alipay.plus.android:iapminiprogram-gmultimap:${iapminiprogram_version}"
}

Step 5. Configure to use the SplitCompat tool

In order to use the SplitCompat tool, need to finish the following configurations:

  1. In the build.gradle file of the project app, add the following codes to import dependencies accordingly:
copy
// In your app’s build.gradle file:
...
dependencies {
    // This dependency is downloaded from the Google’s Maven repository.
    // So, make sure you also include that repository in your project's build.gradle file.
    implementation 'com.google.android.play:feature-delivery:2.1.0'

    // For Kotlin users, also add the Kotlin extensions library for Play Feature Delivery:
    implementation 'com.google.android.play:feature-delivery-ktx:2.1.0'
    ...
}
  1. Turn on the SplitCompat in your application based on the following different cases.

Case

To do

If you have a customized application

You need to add the following codes in the attachBaseContext() function of your current application:

copy
public class MyApplication extends Application {
    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        SplitCompat.install(this);
    }
}

If you do not have a customized application

You need to define a new application as the following codes, which inherits SplitCompatApplication.

copy
public class MyApplication extends SplitCompatApplication {
    ...
}

Step 6. (Optional, for MYWeb only) Optimize the MyWeb dynamic download experience

If you want to optimize the MYWeb dynamic download experience, for example whether a custom dialog box is displayed to explain the reason for downloading, knowing the download status, and so on, to achieve these experiences, use the GriverDynamicFeatureExtension interface.

Next steps

Configure the authorization code

After you integrate the MyWeb module/dynamic feature:

  1. You need to provide the package name of your application and SHA256 signature.
    We will provide you with the authorization code for MYWeb accordingly.
  2. Then in the Android project, you need to configure the authorization code for releaseand debug in the AndroidManifest.xml file and the build.gradle file. Refer to the following code sample:
  • AndroidManifest.xml file:
copy
    <application>
      <!-- configure ${activation_code} placeholder -->
      <meta-data
            android:name="com.alipay.myweb.init.ACTIVATION_CODES"
            android:value="${activation_code}"/>
    </application>
  • build.gradle file:
copy
android {
    buildTypes {
        release {
            /* configure the Release activation_code */
            manifestPlaceholders = [
                    activation_code: "mg*****...="
            ]
        }
        debug {
            /* configure the Debug activation_code*/
            manifestPlaceholders = [
                    activation_code: "4X*****...=="
            ]
        }
    }
}

Note:

  • If the authorization code is incorrect, MYWeb module/dynamic feature will not be enabled and will automatically fall back to the system web view (webview).
  • If you have multiple signatures and package names, need to configure the authorization code based on the different environment accordingly.

FAQ

For troubleshooting, refer to the Android SDK FAQ.