If component-based integration method is used, you need to complete the following general steps to complete the integration process:
Create a new project on the client
This topic describes how to create a local app, compile and package the app, and then obtain an executable .apk
package in Windows-based development environments.
First, you need to:
Create a Portal project
The component-based integration is available where necessary, where you need to create a Portal project first.
Portal typically contains no business code and is only used to combine Bundles into a single executable .apk
package. Therefore, when you create a Portal project, a Bundle project suffixed with Launcher
is created by default.
The creation procedure is as follows:
After launching Android Studio, click Start a new mPaaS project on the welcome page.
In the Create New mPaaS Project window, select mPaaS Portal. Click Next.
Enter the Project name. When selecting the Configuration file path, select the .config file downloaded from Manage codes > Code configuration in the console. The mPaaS plug-in will automatically parse and enter the Package Name based on the selected configuration file. Click Next.
Select an mPaaS SDK version, and check your desired module dependency. Click the Next button.
ImportantPlease check module dependency as required. For more information about dependencies, refer to the document of each component.
You can select only the required dependency for the framework. After creating an app, use the mPaaS Plug-in > Component Management function to add your desired dependency.
Confirm the information about the Bundle project created by default. Click the Finish button.
Now, you have created the Portal project and obtained a Bundle project created by default.
Create a Bundle project
The mPaaS framework supports multiple Bundle projects, allowing you to create multiple Bundle projects for your project.
Click the File > New > Start a New mPaaS Project menu.
In the Create New mPaaS Project window, select mPaaS Portal. Click Next.
Enter the Project name. When selecting the Configuration file path, select the .config file downloaded from Manage codes > Code configuration in the console. The mPaaS plug-in will automatically parse and enter the Package Name based on the selected configuration file. Click Next.
Select an mPaaS SDK version, and check your desired module dependency. Click the Next button.
Confirm the information about the Bundle project created by default. Click the Finish button.
Now, you have created a Bundle project. For more information about Bundle development, see Bundle Project.
Follow-up steps
To integrate and use mPaaS Components, refer to the integration document of each component.
Related topics
Component-based integration > Introduction: Describes the code structure and compilation and package results of Portal and Bundle projects, and their differences from native projects.
Manage component dependency
To make it easier to upgrade the mPaaS SDK baseline and manage component dependencies, you need to upgrade the Android Studio mPaaS plug-in to the latest version first. For more information about how to upgrade the mPaaS plug-in, see Upgrade the mPaaS plug-in.
Manage component dependency
To use an mPaaS component, you need to add the dependency of this component in the Portal and Bundle projects respectively first.
Adding the dependency in a Portal project will ensure that this dependency is packaged and included into your apk.
Adding the dependency in a Bundle project will ensure that you can call the API of this component in the Bundle project.
For a single Portal project, you only need to add the dependency in this Portal project.
If you have already selected the components you want to use when creating your mPaaS project, you can still add and remove components as follows.
Procedure
In Android Studio, select mPaaS > Component-based Access, and in the integration panel that appears, click Start Configuration under Configure/Update Components.
In the component management window that appears, click the corresponding buttons to install your desired components.
If a component is not installed, the corresponding button displays “Uninstalled”. Click this button to install the component.
If a component is installed, the corresponding button displays “Installed”. In this case, click on this button again will uninstall this component.
Follow-up steps
If you have not used the Android Studio mPaaS plug-in to manage component dependencies before, and this is your first time using the Component Management feature, after adding components, you also need to check or modify the following configurations.
Check the
build.gradle
file in the root directory of the Portal and Bundle projects. Make sure that the file contains the following dependencies and the version is not earlier than the following versions:buildscript { ... dependencies { classpath 'com.android.boost.easyconfig:easyconfig:2.8.4' } }
Check the
build.gradle
file in the main module of the Portal project. Make sure that the file contains the following contents:apply plugin: 'com.alipay.portal' portal { allSlinks true mergeAssets true } apply plugin: 'com.alipay.apollo.baseline.update' mpaascomponents{ excludeDependencies=[] }
Delete old dependencies:
ImportantIt is highly recommended that you make a backup of the followings before deleting them.
For the Portal + Bundle mode, you need to delete the dependencies (except
mpaas-baseresjar
) of the mPaaS components at the dependencies node in thebuild.gradle
file under the main module of the Portal project.For a single Portal project, you need to delete the followings from the
build.gradle
file under the main module:apply from: rootProject.getRootDir().getAbsolutePath() + "/mpaas_bundles.gradle" apply from: rootProject.getRootDir().getAbsolutePath() + "/mpaas_apis.gradle"
and delete the
mpaas_bundles.gradle
andmpaas_apis.gradle
files in the root directory of the project. Note that deleting thempaas_apis.gradle
file may lead to the compilation failure. You need to change configurations in the sub-module as described in the following section.
To call the API of the mPaaS component from the sub-module:
For a Portal + Bundle project, you need to add the following into the
build.gradle
file under the sub-module of a Bundle project:apply plugin: 'com.alipay.apollo.baseline.update'
For a single Portal project, you need to delete the following from the
build.gradle
file under the sub-module:apply from: rootProject.getRootDir().getAbsolutePath() + "/mpaas_apis.gradle"
and add the following:
apply plugin: 'com.alipay.apollo.baseline.update'
If the original dependencies include your custom dependencies, you need to Add Custom Dependencies.
If compilation failed due to library conflicts, you can Solve Dependency Conflicts.
Upgrade the baseline
In Android Studio, click mPaaS > Component-based Access, and in the integration panel that appears, click Start Configuration under Access/Upgrade Baseline.
Click the version dropdown box, select a new version, and then click the OK button to upgrade the baseline.
Upgrade a single component
New version
In Android Studio, select mPaaS > Component Upgrade to show the list of components.
View component status and upgrade components. If there is an update available in the upper right corner, then click and update it.
Old version
In Android Studio, select mPaaS > Component Upgrade to show the list of components.
View component status and upgrade components:
If the latest version is currently being used, then no upgrade is required for this component.
Otherwise, a later version is available for this component. Click the status button to upgrade this component.
Add Custom Dependencies
If it is your first time to use the Component Management feature to manage components, but not to upgrade the SDK, then you only need to write the custom dependencies into the dependencies node in the
build.gradle
file under the main module of a Portal project. For example:bundle 'com.alipay.android.phone.mobilesdk:logging-build:2.0.2.180322162837@jar' manifest 'com.alipay.android.phone.mobilesdk:logging-build:2.0.2.180322162837:AndroidManifest@xml'
If it is your first time to use the Component Management feature to manage components and upgrade the SDK, or use the Baseline Upgrade feature to upgrade the SDK, your custom dependencies may need to be re-customized based on the new version. You need to submit a ticket or contact your mPaaS support for confirmation. After re-customization or confirmation that re-customization is not required, you can add custom dependencies as described above.
Build
Use the Build feature provided by the Android Studio mPaaS plug-in to compile a project.