All Products
Document Center

Mobile Platform as a Service:Adapt to targetsdkversion 28

Last Updated:Feb 24, 2023

The former mPaaS standard baseline only supports up to 26 for targetSdkVersion. However, The support to targetSdkVersion is added since If your app needs to upgrade targetSdkVersion to 29, refer to Use mPaaS plug-in to update the SDK to or later, and add configuration according to the following description and return to the relevant function.

Update the SDK and related configuration with reference to mPaaS supports for multi-CPU architecture.

Adapt targetSdkVersion 28

Modify targetSdkVersion


Modify the attribute targetSdkVersion 28 in the build.gradle file under the main module of the project.


  • Modify the attribute targetSdkVersion 28 in the build.gradle file under the main module of the Portal project.

  • The targetSdkVersion in the Bundle project may be left unchanged, but may not be later than that of the Portal project.

Universal configurations


Modify the project AndroidManifest.xml and add the following codes under the application node:

<uses-library android:name="org.apache.http.legacy" android:required="false"/>


Modify the Portal project AndroidManifest.xml:

  • Add the following codes under the application node:

    <uses-library android:name="org.apache.http.legacy" android:required="false"/>
  • Note that SDK has been changed to set through code. You need to remove the following attributes from the LauncherActivity:


Other configurations

Allow HTTP requests

By default, the Android 9.0 network configuration disables HTTP requests and only allows HTTPS requests. Set targetSdkVersion 28 to enable the 9.0 network configuration on 9.0+ devices. If you still need to send HTTP requests, including in mini programs, you can enable it by configuring networkSecurityConfig.

  • Note that Portal & Bundle is a Portal project. Create a network_security_config.xml file under the res/xml directory of the project with the following contents:

    <?xml version="1.0" encoding="utf-8"?>
      <base-config cleartextTrafficPermitted="true">
              <certificates src="system" />
  • Note that Portal & Bundle is a Portal project. Add the following attributes to the application node in AndroidManifest.xml of the project:


    For more information about the configuration, please refer to the Official google documentation.

Crash occurs when setting screen orientation with transparent background Activity

This adaptation point is an Android 8.0 bug. On Android 8.0 devices, when the application targetSdkVersion > 26, opening an Activity with a transparent background will trigger a crash if the screen orientation is set. The specific trigger conditions are:

  • The attribute of windowIsTranslucent or windowIsFloating of the theme used by the Activity is true.

  • The screenOrientation attribute is set in AndroidManifest.xml, or the setRequestedOrientation method is called.

You need to check if all Activities meet the trigger conditions, and note that in addition to your custom style, some common system themes also meet the conditions, for example:


Recommended adaptation:

  1. For the Activity whose theme meets the condition, delete the screenOrientation attribute in AndroidManifest.xml and call the setRequestedOrientation method instead.

  2. Override the setRequestedOrientation method in the corresponding Activity or parent class, with try catch super.setRequestedOrientation() as the ground rule:

     public void setRequestedOrientation(int requestedOrientation) {
         try {
         } catch (Exception ignore) {
  3. BaseActivity, BaseFragmentActivity, andBaseAppCompatActivtiy provided by mPaaS were overwritten, with setRequestedOrientation method as the ground rule.

  4. Make sure that your Activity does not have any exceptions due to screen rotation as this may prevent crashes but may still cause lock orientation to fail on Android 8.0 devices. For example, re-running the lifecycle will result in some member variables being empty.

Source code related to Android 8.0 system:

Android 8.0 bug

Regression test

The full regression test must include Android 9.0+ devices. For crash issue in Activity setting screen orientation against the transparent background, make specific tests on Android 8.0 models.

For regression test, you need to focus on the following component functions, if used:


Validation project

Mobile gateway

- Whether the RPC call succeeds after enabling Signature validation.

- Whether the RPC call succeeds after enabling Data encryption.


- Whether the standard UI scans the code successfully.

- Whether the standard UI opens the phone album, takes photos and previews properly.

- If the custom UI is successful, you need to adapt part of the new API.

Unified data storage

- Whether Database encrypted storage functions well.

- Whether File encrypted storage functions well.


- Whether Share on Sina Weibo and/or QQ functions well.