Usage scenarios

In the process of using the MPAAS framework, there are times when you need to reuse modules. Reuse requires adding modules in the same way that Module dependencies are used. This article takes the Module that will reuse the MPAAS scanning component as an example to illustrate.

The premise condition

The project has been connected to MPAAS according to the native AAR access mode.

steps

  1. Create an Android Library-type module “Scan” in the Android project.

  1. Add it in the build.gradle file of the newly created scan moduleapi platform("com.mpaas.android:$mpaas_artifact:$mpaas_baseline"). Here is an example:
Dependencies {... // When using MPAAS components in the Mmoudle, you must add the API Platform ("com.mpaas.android:$mpaas_artifact:$mpaas_baseline")... }
  1. Install the scan component for the Scan module with the Android Studio MPAAS plugin. The specific menu path is: MPAAS > native AAR access > configuration/update component > start configuration. After installation, the scan component component will automatically load.

  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'}
  1. Invoke the component module. Where the scan component is used, import the Scan module.
dependencies { api platform("com.mpaas.android:$mpaas_artifact:$mpaas_baseline") .... API project(':scan')// Scan component}

Written by Liu Qiyang


Click to learn more and see more information about MPAAS.