All Products
Search
Document Center

Use mPaaS plug-in

Last Updated: May 14, 2021

The GUI-based mPaaS Plugin supports quick access to mPaaS and provides functions for convenient use. The mPaaS Plugin provides the following functions: Native AAR Access, mPaaS Inside Access, Component-Based Access, Basic Tools, Help and Build.

  • An access panel is available for the Native AAR Access, mPaaS Inside Access and Component-Based Access functions. The access wizard on the access panel can guide you to add mPaaS to your project through a specific access mode. After the access is complete, you can also update the baseline and manage components on the access panel.
  • The mPaaS Plugin provides the following Basic Tools: Hotfix, Generate Encryption Image (Apsara Stack Config File), Generate Signed APK, and Generate UC Key Signing Info. These tools assist you to prepare necessary information for easy use of mPaaS functions.
  • The mPaaS Plugin provides the following Help functions: Log Diagnostic Tool, Common Issues, and View Documentation, to support you to troubleshoot common issues.
  • Build allows you to build a project after you get access to mPaaS.

Add a configuration file

Prerequisites

  • You have an Ant Group or Alibaba Cloud account with the mPaaS service activated.
  • You have created an application on the mPaaS console. For more information about application creation, see Create mPaaS application on the console.
  • An Android project already exists.

Procedure

  1. Open the existing project in Android Studio and then click mPaaS > Native AAR Access, mPaaS Inside Access or Component-Based Access. On the access panel, click Start Import below Import App configuration.
  2. Select I have downloaded the configuration file (Ant-mPaaS-xxxx.config) from the console for import and then click Next.
  3. Select the configuration file and click Finish. The configuration file is imported to the project. After the process finishes, you will receive a prompt message that the configuration file has been imported successfully.

AAR access

Procedure

  1. Open the existing project in Android Studio, click mPaaS > native AAR access.
  2. Import App configuration.
    On the access panel, click Start Import, follow Add a configuration file to add a configuration file.

Follow-up steps

  1. Add and update a baseline
  2. Configure and update components

mPaaS Inside access

Procedure

  1. Open the existing project in Android Studio and click mPaaS > mPaaS Inside Access.
  2. Import App configuration.
    On the access panel, click Start Import, follow Add a configuration file to add a configuration file.
  3. Convert the project. If the project is a native Android project, you need to convert the project.
    1. On the access panel, click Install mPaaS Inside.
    2. Register an account on the official home page of mPaaS and create an application. After application creation, download the configuration file. Then click Next.
      If you have completed the previous steps before you obtain the configuration file, click Next directly.
      3.In the Convert window, select the added configuration file and click Finish.

After migration is complete, the following message is displayed in Android Studio.

Follow-up steps

  1. Add and update a baseline
  2. Configure and update components

Component-based access

Procedure

  1. Open the existing project in Android Studio and click mPaaS > mPaaS Inside Access.
  2. Import App configuration.
    On the access panel, click Start Import, follow Add a configuration file to add a configuration file.
  3. Convert the project. If the project is a native Android project, you need to convert the project.
    On the access panel, click Install mPaaS Portal. In the Install mPaaS Portal window, select the location and configuration file of the original project and then click OK.

Follow-up steps

  1. Add and update a baseline
  2. Configure and update components

Add and update a baseline

Update to a common baseline

Procedure

  1. Click mPaaS > Native AAR Access, mPaaS Inside Access, or Component-Based Access to open the access panel. Then click Start Config below Add and update baseline.
  2. Select the baseline version to be updated and click OK.

    After the update is complete, a success message is displayed as follows.

Follow-up steps

Click the updated baseline on the access panel. You will see the baseline version in the baseline selection window.

Update to a custom baseline

We provide baselines specific to all customers, such as 10.1.32, 10.1.60 and 10.1.68. If you need custom mPaaS functions, you can contact our staff and make a request. We will customize baselines for you as demanded. mPaaS staff will deliver the ID of your custom baseline. You can obtain the custom baseline after you enter this ID in the mPaaS Plugin.

Prerequisites

mPaaS V2.19111217 or later version is required in Android Studio. See Update the mPaaS Plugin to check the current mPaaS Plugin version and learn how to update the mPaaS Plugin.

Procedure

  1. Delete the mpaas_package.json file of the project in Android Studio.
  2. Click mPaaS > Native AAR Access, mPaaS Inside Access, or Component-Based Access to open the access panel. Then click Start Config below Add and update baseline.
  3. In the baseline update dialog, select Custom baseline and enter the custom baseline ID.
  4. Click OK. The custom baseline is added.

Configure and update components

mPaaS component management (AAR)

Prerequisites

You have updated the baseline.

Procedure

  1. Click mPaaS > Native AAR Access to open the access panel. Then click Start Config below Configure and update components.
  2. In the displayed management window, click mPaaS Component Management. Then select the module and components to be managed and click OK. If your project contains multiple modules, you can select individual modules and select components for each module respectively.
  3. After the components are added, click OK.

Component Management

Procedure

  1. Click mPaaS > mPaaS Inside Access or Component-Based Access to open the access panel. Then click Start Config below Configure and update components.
  2. In the displayed component management window, click the corresponding buttons to install the required components.

Basic tools

Basic Tools provide the following functions: Hotfix, Generate Encryption Image (Apsara Stack Config File), Generate Signed APK, and Generate UC Key Signing Info.

Hotfix

You need to integrate the hotfix component into an App before you use the hotfix function. For details, see Hotfix Management: Access Android - Hotfix.

Create a hotpatch

The mPaaS Plugin provides the Create Hotpatch function. Perform the following steps to create a hotpatch:

  1. Select packages depending on the actual mPaaS access mode and then use the Create Hotpatch tool of mPaaS Plugin to create the corresponding hotpatch.
    • If your project is a Native AAR project or mPaaS Inside project, you need to prepare the serving APK with bug and the APK with bug fixed. The mPaaS Plugin will create a hotpatch based on the code difference between these two APKs.
      Tip:
      • In the New bundle field, enter the local address of the APK with bug fixed.
      • In the Old bundle field, enter the local address of the APK with bug.
      • In the Whitelist field, enter the whitelist.
    • If your project is a Component-based (Portal&Bundle) project, you need to prepare the serving bundle with bug and the bundle with bug fixed.
      Tip:
      • The path to bundle is build/intermediates/bundle/xxxx-raw.jar under the main module directory. There is no -raw for a released bundle.
      • New bundle: select the path of the bundle with bug fixed.
      • Old bundle: select the path of the bundle with bug.
      • Whitelist: select the configuration file in .txt format that specifies the fixed classes. To know the rules for editing a configuration file, see Rules for editing a whitelist configuration file. We strongly recommend this function for native AAR projects and mPaaS Inside projects.
      • Patch file dir: select a path for the output patch.
      • Use dexPatch or not: select whether to use the dexPatch mode. The Create Hotpatch function in mPaaS Plugin supports two hotfix schemes: Andfix and dexPatch. Before you release the bundle, verification is required to ensure that the hotfix can take effect no matter which scheme is used.
        • If this check box is not selected, an Andfix patch will be created. An Andfix patch can take effect instantly. You do not need to restart your application. However, the Andfix scheme is only applicable to specific scenarios due to limitation of models.
        • If this check box is selected, a dexPatch will be created. A dexPatch will not take effect instantly. The dexPatch takes effect after you terminate the process. The dexPatch scheme is applicable to more scenarios and models than Andfix.
  2. Enter the signing information to create the hotpatch.
    Caution: The signature file required for creating the hotpatch must be consistent with the signature file of the serving APK and the APK signature file selected for creating an image. The created image must be stored in the res/drawable folder of the Portal project and named as yw_1222.jpg.
Rules for editing a whitelist configuration file

The configuration file in .txt format specifies the classes to be fixed by the patch. You must edit the following information in sequence in the configuration file:

  1. Class to be fixed in the Patch. The class starts with the letter L, followed by the real class name after confusion. If you need to fix multiple classes, edit each class on a separate line.
    Example: Lxxx.xxx.clazzX
  2. Set the Patch type to dexpatch.
    Example: PatchType: dexpatch
  3. Specify whether the patch is a static Bundle. The default setting is false. For the Bundle of a static link, you need to explicitly set the value to true.
    Example: HostDex: true

You can refer to An example of whitelist configuration file.

Merge patches

You can run only one hotpatch for an Android App version at a time. If a version on the client has two bugs, you need to locally merge two hotpatches into one by using the Merge Patches function. For example, a hotpatch A has been released for an app version, but you find another bug in this version. In this case, you can create another hotpatch B locally, merge these two patches into one, and then send the final hotpatch to the client.

Note: This section is only applicable to component-based (Portal&Bundle) projects. For a native AAR project or mPaaS Inside project, you can create and release another patch based on the previous hotpatch.
Procedure
  1. Enter hotpatch directories.
    • Merge dir: select the directory of hotpatches to be merged. This directory contains all hotpatches to be merged. Patch files must be in .jar or .apk format.
    • Patch file dir: select the directory where the final hotpatch will be stored.
  2. Configure signing information.

After the hotpatch merge is complete, a success message is displayed.

Generate the encryption image (Apsara Stack configuration file)

When some components of the mPaaS Plug-in (such as hotfix) get access to the network, the contents must be encrypted to ensure security. The image named as yw_1222.jpg provides a secret key for encryption and decryption. The components of mPaaS Plugin automatically use this image for encryption and decryption.The following describes how to generate and use the encryption image yw_1222.jpg.

Preparations

The encrypted image is bound with the APK signature file. Therefore, you need to prepare the signed APK of your Portal project. For detailed signing instructions, see Android official website: Sign your app.

Notes:
  • This APK uses the same signature file as the Release Version APK.
  • The generated encrypted image can only be used in this APK project.

Generation

You can use mPaaS Plugin to generate the encryption image.

  1. In Android Studio, click mPaaS > Basic Tools > Generate Encryption Image (Apsara Stack Config File).
  2. In Release Apk, select the signed APK of the Portal project. The RSA field is automatically filled.
  3. In mPaaS Config File, select the .config file of the Portal project. The workSpaceId, appId and packageName fields are automatically filled. If these fields are not automatically filled, enter the corresponding configurations according to the contents in the .config file of the project.
  4. Fill the appsecret field.
    Caution: As the server administrator, you can query the corresponding appsecret of appid on the console.
  5. In the jpg Version field, enter the version number of the security guard image.
    Note: Check the securityguard version in the build.gradle file under the main module of the Portal project. Enter 4 if the version is lower than 5.4 (such as securityguard-build:5.1.38.180402194514 in the baseline). Otherwise, enter 5.
  6. In outPath, select an output path for the security guard image yw_1222.jpg. The generated encryption image will be stored under this local path.
  7. Click OK to generate the encryption image.

Usage

The following describes how to use the encryption image:

  1. Store the encryption image yw_1222.jpg in the res/drawable folder of the Portal project.
  2. If ProGuard is used, you need to avoid confusion of the encryption image.
    1. Check whether build.gradle contains the following configurations:
      1. minifyEnabled true
      2. shrinkResources true
    2. If yes, you need to create a keep.xml file under res/raw to avoid confusion of the encryption image. The file content is as follows:
      1. <?xml version="1.0" encoding="utf-8"?>
      2. <resources xmlns:tools="http://schemas.android.com/tools"
      3. tools:keep="@drawable/yw_1222*" /><!--tools:discard="@layout/unused2"-->

Generate signed APK

When you attempt to obtain the configuration file on the mPaaS console, you need to upload a signed APK file, as shown in the following figure. The procedure will be suspended if you have not created a project or compiled the signed APK. The mPaaS Plugin provides the function Generate Signed APK to simplify this procedure in Android Studio. This function can generate a signed APK after you input necessary parameters for APK signing.

Generation

  1. Click mPaaS > Basic tools > Generate Signed APK to open the Build Signed APK page.
  2. In the Build Signed APK page, enter the required configuration information.
  3. Click OK The signed APK is generated.
  4. Click Reveal in Finder You can find the generated APK file. The file name is mpaas-signed.apk. The generation of signed APK is complete.
    Open the APK file. You can find the file is small and has been signed.

Generate UC Key signing information

The integration of UC SDK in Android applications can effectively solve incompatibility issues of various browsers. Prior to the integration, you need to apply for authorization from UC SDK. This function can help you to obtain the authorization quickly. The following describes how to apply for authorization from UC SDK.

Note: This function is available in V2.20062211 and later versions. For more information, see V2.20062211 Release Notes.

Procedure

  1. Add UCCORE dependency in the project.
  2. Submit Android native package name of the application.
  3. Click mPaaS > Basic Tools > Generate UC Key Signing Info to open the Query Signing Info page.
  4. On the Query Signing Info page, enter the required configuration information. Click Next.
  5. Copy the obtained SHA1 information.
  6. Log on to the console and open the Submit Tickets page. Submit Android native package name and SHA1 value to obtain the authorized key from UC SDK.
    Note: While creating a ticket, select Mobile Development Platform mPaaS from Products (on the menu More Products and Services > DevTools ) and select the issue class Development Framework-Development Framework-Android Access. In addition to your contact information, fill in the “UC SDK key”, Android native package name and SHA1 value in Issue description.
  7. Enter the obtained key in the ‘AndroidManifest.xml’ file of the Portal project.
    <meta-data android:name="UCSDKAppKey" android:value="Obtained key"/>
    Note: The authorization information of the UC SDK is bound to the package name and signature of the APK. Therefore, if UCWebView does not take effect, check whether the signature and package name are consistent with those entered for applying a key.

Help

Log diagnostic tool

  1. Click mPaaS > Help > Log Diagnostic Tool.
  2. Copy and paste the log to be analyzed in the text box and click Next.
  3. Wait until the analysis is completed.
  4. View the analysis result.
    The analysis result contains Cause and Solution. You can modify your codes according to the cause and solution if any issue is found.
  5. After the modification, click Finish to close the window.

FAQ

Click mPaaS > Help > Common Issues to go to Common Android access issues. You can check common issues that you may encounter when you access Android.

View Document

Click mPaaS > Help > View Document to go to mPaaS Document Center. You can view the documents of all components.

Build

In Android Studio, select mPaaS > Build. Then you can build your project.