All Products
Search
Document Center

Access procedure

Last Updated: May 21, 2021

Introduction to access process

If component-based access is used, you need to complete the following general steps to complete the access process:

  1. Configure a development environment.
  2. Create an app in the console.
  3. Create a new project on the client.
  4. Manage component dependency.
  5. Build.

Create a new project on the client

About this task

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.

Prerequisites

First you need to:

  1. Configure a development environment
  2. Create an app in the console

Create a Portal project

The component-based access 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. Therefeore, when you create a Portal project, a Bundle project suffixed with Launcher is created by default.

The creation procedure is as follows:

  1. After launching Android Studio, click Start a new mPaaS project on the welcome page.

  2. In the Create New mPaaS Project window, select mPaaS Portal. Click Next.

  3. 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.

  4. Select an mPaaS SDK version, and check your desired module dependency. Click the Next button.

    Important:
    • Please 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 you desired dependency.
  1. 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.

  1. Click the File > New > Start a New mPaaS Project menu.

  2. In the Create New mPaaS Project window, select mPaaS Portal. Click Next.

  3. 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.

  4. Select an mPaaS SDK version, and check your desired module dependency. Click the Next button.

  5. 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 access and use mPaaS Components, refer to the access document of each component.

Component-based Access > 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 access panel that appears, click Start Configuration under Configure/Update Components.

  1. 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.

  1. 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:
       
    1. buildscript {
    2. ...
    3. dependencies {
    4. classpath 'com.android.boost.easyconfig:easyconfig:2.5.0'
    5. }
    6. }
  2. Check the build.gradle file in the main module of the Portal project. Make sure that the file contains the following contents:
       
    1. apply plugin: 'com.alipay.portal'
    2. portal {
    3. allSlinks true
    4. mergeAssets true
    5. }
    6. apply plugin: 'com.alipay.apollo.baseline.update'
    7. mpaascomponents{
    8. excludeDependencies=[]
    9. }
  3. Delete old dependencies:

Important: It 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 the build.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:
       
    1. apply from: rootProject.getRootDir().getAbsolutePath() + "/mpaas_bundles.gradle"
    2. apply from: rootProject.getRootDir().getAbsolutePath() + "/mpaas_apis.gradle"
    and delete the mpaas_bundles.gradle and mpaas_apis.gradle files in the root directory of the project. Note that deleting the mpaas_apis.gradle file may lead to the compilation failure. You need to change configurations in the sub-module as described in the following section.
    1. 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:
       
    1. 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:
       
    1. apply from: rootProject.getRootDir().getAbsolutePath() + "/mpaas_apis.gradle"
    and add the following:
       
    1. apply plugin: 'com.alipay.apollo.baseline.update'
    1. If the original dependencies include your custom dependencies, you need to Add Custom Dependencies.
    2. If compilation failed due to library conflicts, you can Solve Dependency Conflicts.

Upgrade the baseline

  1. In Android Studio, click mPaaS > Component-based Access, and in the access panel that appears, click Start Configuration under Access/Upgrade Baseline.
  2. 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

  1. In Android Studio, select mPaaS > Component Upgrade to show the list of components.
  2. View component status and upgrade components. If there is an update available in the upper right corner, then click and update it.
    Component upgrades

Old version

  1. In Android Studio, select mPaaS > Component Upgrade to show the list of components.
  2. 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.
      Components Update

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:

       
    1. bundle 'com.alipay.android.phone.mobilesdk:logging-build:2.0.2.180322162837@jar'
    2. 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.