Usage scenarios

In the process of using the mPaaS framework, it is sometimes necessary to reuse modules. Reuse requires adding modules in the same way as using Module dependencies. This article uses the Module that will reuse the mPaaS scanning component as an example.

The premise condition

The project has been connected to mPaaS in accordance with the original AAR access mode.

steps

  1. Create the Android Library type module “scan” in the Android project.

  1. Add in the build.gradle file of the newly created Scan moduleapi platform("com.mpaas.android:$mpaas_artifact:$mpaas_baseline"). The following is an example:
Dependencies {... // Add API platform("com.mpaas.android:$mpaas_artifact:$mpaas_baseline") when using mPaaS components in moudle... }Copy the code
  1. Install the scan component for the Scan module using the Android Studio mPaaS plug-in. The menu path is mPaaS > Native AAR Access > Configure/Update Components > Start Configuration. After the installation, the scan component is automatically loaded.

  1. Configure the App main project.
plugins { id 'com.android.application' ...... / / must be under the app build. Add baseline gradle. Config (baseline) id 'com. Alipay. Apollo. Baseline. Config'}Copy the code
  1. Invoke component modules. Import the SCAN module where the scan component is used.
dependencies { api platform("com.mpaas.android:$mpaas_artifact:$mpaas_baseline") .... API project(':scan')//Copy the code

Article: Liu Qiyang


Click to learn more and check out mPaaS for more information.