Integrate the mPaaS kernel

更新时间:
复制 MD 格式

Replace the UC kernel with the mPaaS MyWeb kernel in your Android app by configuring Maven, adding Gradle dependencies, obtaining an authorization code, and validating the result.

Prerequisites

Before you begin, make sure your app meets the following requirement:

Note

Your app's baseline version must be 10.2.3.55 or later.

Integration steps

  1. Add a new Maven repository configuration. For details, see Manually configure a Maven repository.

  2. In your app's build.gradle file, add the following configuration. For SDK version numbers, see mPaaS kernel release notes.

    android {
      ...
       configurations {
            // Remove UC
            all*.exclude group: 'com.mpaas.mriver', module: 'mriveruc-build'
            all*.exclude module: 'nebulauc-build'
       }
    
       packagingOptions {
          exclude '**/libWebViewCore_**.so'  // Remove unnecessary .so files to reduce the package size
       }
    }
    
    dependencies {
      ...
      api 'com.mpaas.myweb:mpaasmywebapi-build:xxx@aar'
      api 'com.mpaas.myweb:mpaasmyweb:xxx@aar'
      
      // Required for Mini Program containers. Do not add if you are not using Mini Programs.
      api 'com.mpaas.mriver:mrivermyweb-build:xxx@aar'
      
      // Required for H5 containers.
      api 'com.mpaas.nebula:nebulamyweb-build:xxx@aar'
    }
  3. Add the following ProGuard obfuscation rule:

    -keep class com.alipay.mywebview.** {*;}
  4. Request an authorization code, then add it to your AndroidManifest.xml file:

    <meta-data
                android:name="MPKernelAuthKey"
                android:value="xxx" />
    Important

    The request requires your APK package name and SHA-256 signature digest.

Get the SHA-256 signature digest

Use one of the following methods:

Method 1: apksigner

Use the apksigner tool from the Android SDK:

apksigner verify -v --print-certs test.apk | grep 'certificate SHA-256'

// Sample output
Signer #1 certificate SHA-256 digest: 389b49f7832f53e9017923220aa85e14dfaa4886ecd7428818bf339543cf498a

Method 2: keytool

Use the keytool command from the JDK:

keytool -printcert -jarfile test.apk | grep SHA256

// Sample output 
 SHA256: A0:02:3F:10:D8:B9:8F:FF:E2:57:4B:47:A6:46:30:0C:67:98:5E:BF:5A:98:BB:D5:25:32:DE:E6:F8:91:27:07

Verify the integration

Filter the logs for the WebView version. If the version number is 0.11.xxx, the kernel is successfully integrated.

image.png

For existing customers

If your app previously used the UC kernel, confirm the following before going live:

  • Check for customized kernel logic. Search your code for import com.uc.xxxxx. If any matches appear, reimplement that logic using the new interfaces.

  • The new kernel no longer supports Nebula Mini Programs. If you use Nebula Mini Programs, upgrade to the new Mini Program container first.

  • Run regression testing on the following areas:

    • H5 container: Test all H5 page functions, including embedded H5 pages in Mini Programs and cases where you dynamically switch to the system kernel.

    • Mini Program container: Test rendering, components, APIs, and plugins.