All Products
Document Center

Create a native project

Last Updated: Aug 24, 2021

In this topic, you will create an application on which a toast pops up when you click the text, and get a signed APK package. This process mainly includes the following four steps:

  1. Create a project
  2. Compile the project
  3. Create a signature file and sign the project
  4. Install the app on a mobile phone

If you already have a native Android project and the project has already been signed, redirect directly to Create an application in the mPaaS console.


Before starting to create a project, make sure you have installed the mPaaS plug-in.

Create a project

  1. Start Android Studio, and click File > New > New Project.


  2. In the Create New Project dialog box that appears, select Empty Activity, and click Next.


  3. Set the project name (Name), package name (Package name), and storage path (Save location). These steps take the “mPaaS CDP” project as an example. Select API 18: Android 4.3 (Jelly Bean) as the Minimum SDK.

    Create an project

  4. Click Finish to complete the project creation.

Compile the project

  1. Open the activity_main.xml file and refer to the following codes to add a button.

    1. <Button
    2. android:id="@+id/button"
    3. android:layout_width="101dp"
    4. android:layout_height="50dp"
    5. android:layout_marginStart="142dp"
    6. android:layout_marginTop="153dp"
    7. android:layout_marginBottom="151dp"
    8. android:text="Button"
    9. app:layout_constraintStart_toStartOf="parent"
    10. app:layout_constraintTop_toTopOf="parent" />

    Add a button

  2. Open theMainActivity class and add a click event for the button.

    1. findViewById( View.OnClickListener(){
    2. @Override
    3. public void onClick(View v) {
    4. Toast.makeText(MainActivity.this, "Hello mPaaS!", Toast.LENGTH_SHORT).show();
    5. }
    6. });

    Add an event

  3. After a successful compilation, you have finished the code writing.

Create a signature file and sign the project

When configuring the component code in the mPaaS console, you need to use the signed APK file.

The steps to sign for the project and generate the APK file are as follows:

  1. In Android Studio, choose Build > Generate Signed Bundle / APK.


  2. In the dialog box that appears, select APK, and click Next.


  3. Select Create new.


  4. Enter all the required information, and click OK to complete signature creation. You can obtain the generated signature file in the specified Key store path.


  5. After the fields are automatically entered, click Next to start signing for the project.


  6. Select Build Variants as needed, and check the encrypted version V1 (Jar Signature).
    Note that V1 (Jar Signature) is required while V2 (Full APK Signature) is optional.


  7. Click Finish. After a while, in the debug folder (~\mPaaSCDP\app\debug) under the project folder, you can get the signed APK package of the project. In these steps, the name of the package is app-debug.apk.

Install the app on a mobile phone

  1. Connect a mobile phone to the computer and enable the USB Debugging mode of the mobile phone.
  2. In Android Studio, run the project to install the application on your phone.


  3. Open the app and tap BUTTON. The toast “Hello mPaaS!” appears, as shown at the bottom of the screen. The display of this toast indicates that the app is installed and can function as expected. At this point, you have successfully installed the application on your phone.

    hello mpaas