All Products
Document Center

Use common components of mPaaS framework(optional)

Last Updated: Apr 01, 2021

About this topic

This topic is intended to solve the adaptation problem with the general-purpose components of the native mPaaS framework when the component-based access mode is changed to the native AAR access mode. This topic can be ignored if general-purpose components of the mPassS framework are not used.

For compatibility with component-based access solutions, the following four components can be used in form of apt on 10.1.60 baseline or later versions:

Note: These four components are used in the same way as in component-based access mode. You can click a component name to view its details.

Use of Components

  1. Add related dependencies into library and application projects.

    1. implementation ''
    2. The apt access mode of kapt '' // kotlin
    3. The apt access mode of annotationProcessor '' // java
  2. Append specific annotations respectively when defining the preceding four components. There are four types of annotations:

    • @Application
    • @Service
    • @BroadcastReceiver
    • @Pipeline

    The parameter in annotation is the same as that defined in metainfo.xml. For example, when using @Application, you just need to do as follows:

    1. @Application(appId = "123123")
    2. public class MicroApplication extends ActivityApplication {
    3. }

When the library module is not used

If you do not use the library module, APP Module you only need to add it @MetaInfoApplication to any class in your project.If you use the easyconfig plug-in in combination (a common practice), you also need to turn on a switch. See the following examples:

  1. @MetaInfoApplication(compatibleWithPlugin=true)

When the library module is used

If library module the preceding 4 components are defined in your project, you must perform the following operations:

  1. Declare any class, @MetaInfoLibrary and introduce the packageName of the library module for the parameter involved. For example:

    1. @MetaInfoLibrary(applicationId=BuildConfig.APPLICATION_ID)
  2. Add @MetaInfoApplication to any class in the app module project, and introduce the generated in library module for dependency. For example:

    1. @MetaInfoApplication(dependencies={com.mylibrary.MetaInfoConfig.class})

    If you use the easyconfig plug-in in combination (a common practice), you also need to turn on a switch. The following shows the example in which an enable switch is integrated:

    1. @MetaInfoApplication(dependencies={com.mylibrary.MetaInfoConfig.class}, compatibleWithPlugin = true)

    Obfuscation related

Add related classes into the obfuscation allowlist, especially The following command can be used:

  1. -keep public class