Upgrade component-based/mPaaS Inside integration method to AAR integration method

Updated at:

The native Android Archive (AAR) integration method uses the Android Gradle Plugin and Gradle Wrapper to manage mPaaS baselines directly, replacing the proprietary component-based and mPaaS Inside integration methods. You must use Android Gradle Plugin 3.5.3 and Gradle Wrapper 5.6 or later. The current stable versions are Android Gradle Plugin 3.6.x and Gradle Wrapper 6.3.

Identify your current integration method and follow the corresponding upgrade path:

After completing the migration steps for your path, follow Use the AAR integration method to finish the setup.

Prerequisites

  1. Upgrade the easyconfig plugin to version 2.8.4.

  2. Upgrade Gradle to version 5.0 or later.

Upgrade component-based integration to native AAR integration

Update plugins

  • Update the Gradle Wrapper and Android Gradle Plugin to the required versions. You must use Gradle 5.0 or later.

  • In the root build.gradle file, remove classpath 'com.alipay.android:android-gradle-plugin'.

  • In each bundle, remove all com.android.application plugins. All bundles use the com.android.library plugin from the native project.

  • Remove all com.alipay.bundle plugins from each bundle.

  • Remove the bundle {} DSL definition from the bundle. You can also remove the public.xml definition, or keep it if needed.

  • Remove all com.alipay.portal plugins from the portal.

  • Remove the portal {} DSL definition from the portal. You can also remove the public.xml definition, or keep it if needed.

  • Change apply plugin: 'com.alipay.apollo.baseline.update' to apply plugin: 'com.alipay.apollo.baseline.config'.

Update dependencies

  • In the dependencies node, remove all provided and bundle declarations. The AAR integration method uses a bill of materials (BOM) to centrally manage all mPaaS dependency versions — replace those declarations with implementation entries and a single platform() BOM line:

        implementation 'com.mpaas.android:push'
        implementation 'com.mpaas.android:nebula'
        implementation 'com.mpaas.android:push-hms5'
        implementation platform("com.mpaas.android:mpaas-baseline:$(latest)")
    
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'androidx.test.ext:junit:1.1.1'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    The $(latest) variable represents the latest baseline released by mPaaS. If you use the standard baseline, do not change the value of mpaas-baseline. Otherwise, change it to the artifact of the custom baseline.

  • Remove the loading frame and customizations. For more information, see Loading frame and customizations.

Update universal component configuration

If you use the metainfo.xml file to define universal components, see Use mPaaS framework universal components.

Update hotpatching configuration

If you use the hotpatching feature, replace com.alipay.mobile.quinox.LauncherApplication in the portal project with com.alipay.mobile.framework.quinoxless.QuinoxlessApplication, then initialize the project following the hotpatching procedure for the AAR integration method. For more information, see Use the hotpatching feature. If you do not use hotpatching, replace it with android.app.Application.

Remove deprecated files

The slinks and res_slinks files are no longer required.

Add Mini Programs support

Add the following configuration to the AndroidManifest.xml file:

<application>
    ···
    <meta-data android:name="nebula.android.meta.enable" android:value="true"/>
  ···
</application>

Potential problems

Later versions disable v1 signing by default. This may cause Security Guard to report an error if a v1 signature is missing. To troubleshoot this issue, see How to resolve runtime error 608 or libsgmain native errors.

Verify your configuration

After completing the steps above, verify your build script configuration. For more information, see Check the build script configuration.

Upgrade the mPaaS Inside integration method to the AAR integration method

Update plugins

  • Update the Gradle Wrapper and Android Gradle Plugin to the required versions. You must use Gradle 5.0 or later.

  • In the root build.gradle file, remove classpath 'com.alipay.android:android-gradle-plugin'.

  • Remove all com.alipay.portal plugins from the portal.

  • Remove the portal {} DSL definition from the portal. You can also remove the public.xml definition, or keep it if needed.

  • Change apply plugin: 'com.alipay.apollo.baseline.update' to apply plugin: 'com.alipay.apollo.baseline.config'.

Update dependencies

In the dependencies node, remove all provided and bundle declarations. Import AAR dependencies using a bill of materials (BOM), which centrally manages all mPaaS dependency versions through a single platform() line:

    implementation 'com.mpaas.android:push'
    implementation 'com.mpaas.android:nebula'
    implementation 'com.mpaas.android:push-hms5'
    implementation platform("com.mpaas.android:mpaas-baseline:$(latest)")

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

The $(latest) variable represents the latest baseline released by mPaaS. If you use the standard baseline, do not change the value of mpaas-baseline. Otherwise, change it to the artifact of the custom baseline.

Update universal component configuration

If you use the metainfo.xml file to define universal components, see Use mPaaS framework universal components.

Update gradle.properties

quinoxless=true is no longer required. You can keep or delete existing quinoxless=true configurations.

Potential problems

Later versions disable v1 signing by default. This may cause Security Guard to report an error if a v1 signature is missing. To troubleshoot this issue, see How to resolve runtime error 608 or libsgmain native errors.

Verify your configuration

After completing the steps above, verify your build script configuration. For more information, see Check the build script configuration.

Use the AAR integration method

  1. Add the mPaaS SDK to your project.

  2. Add required components to each module.