The former mPaaS standard baseline only supports up to 26 for targetSdkVersion. However, The support to targetSdkVersion is added since 10.1.68.21. If your app needs to upgrade targetSdkVersion to 29, refer to Use mPaaS plug-in to update the SDK to 10.1.68.21 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
AAR
Modify the attribute targetSdkVersion 28 in the build.gradle
file under the main module of the project.
Portal&Bundle
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
AAR
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"/>
Portal&Bundle
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:
android:screenOrientation="portrait"
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 theres/xml
directory of the project with the following contents:<?xml version="1.0" encoding="utf-8"?> <network-security-config> <base-config cleartextTrafficPermitted="true"> <trust-anchors> <certificates src="system" /> </trust-anchors> </base-config> </network-security-config>
Note that Portal & Bundle is a Portal project. Add the following attributes to the application node in
AndroidManifest.xml
of the project:android:networkSecurityConfig="@xml/network_security_config"
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
orwindowIsFloating
of the theme used by the Activity is true.The
screenOrientation
attribute is set inAndroidManifest.xml
, or thesetRequestedOrientation
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:
@android:style/Theme.Translucent.NoTitleBar
@android:style/Theme.Dialog
Recommended adaptation:
For the Activity whose theme meets the condition, delete the
screenOrientation
attribute inAndroidManifest.xml
and call thesetRequestedOrientation
method instead.Override the
setRequestedOrientation
method in the corresponding Activity or parent class, withtry catch super.setRequestedOrientation()
as the ground rule:@Override public void setRequestedOrientation(int requestedOrientation) { try { super.setRequestedOrientation(requestedOrientation); } catch (Exception ignore) { } }
BaseActivity
,BaseFragmentActivity
, andBaseAppCompatActivtiy
provided by mPaaS were overwritten, withsetRequestedOrientation
method as the ground rule.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:
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:
Components | Validation project |
Mobile gateway | - Whether the RPC call succeeds after enabling Signature validation. - Whether the RPC call succeeds after enabling Data encryption. |
Scan | - 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. |
Share | - Whether Share on Sina Weibo and/or QQ functions well. |