targetSdkVersion is used to specify the target Android version (API level) for an application. Setting a value for targetSdkVersion indicates which Android version (API level) the app is adapted for. If the platform's API level is higher than the version declared by the app's targetSdkVersion, the system can enable compatibility behaviors. Therefore, setting a lower targetSdkVersion causes the APP to run in compatibility mode, which may prevent the use of new system features. Running in compatibility mode may also lead to security vulnerabilities and other issues. Developers should therefore configure this value with caution.
Note
-
For multi-platform applications, the default
targetSdkVersionin Developer Tools is 29. The minimum value that can be set is also 29 (i.e., developers can set values ≥ 29; some application stores require a highertargetSdkVersionfor submission, so developers should set it according to the specific requirements of the application store when submitting for review). -
When upgrading an App,
targetSdkVersioncan only be increased, not decreased. This means an App with a highertargetSdkVersioncannot be overwritten by an App with a lowertargetSdkVersionduring installation. -
The
targetSdkVersionvalue must be of the Number type and must be a positive integer. For the valid range, refer to the API levels listed in the Android version table below.
I. targetSdkVersion Configuration Guide
Upgrade the Developer Tools to the latest nightly version, switch to Multi-Platform Mode, and click project.miniapp.json. Locate "Other Common Settings" under the Android section. You can refer to the image below to configure targetSdkVersion.
- After configuration, you must rebuild the APK for the changes to take effect.
- minSdkVersion is used to configure the integer representing the minimum API level required for the app to run. If the system's API level is lower than the value specified in this attribute, the Android system will prevent users from installing the app. The default value is 21. Please do not enter a value lower than 21.
II. API Level and Android Version Mapping
For more details, see the official documentation: https://developer.android.com/guide/topics/manifest/uses-sdk-element?hl=zh-cn
| Platform Version | API Level |
|---|---|
| Android 14 | 34 |
| Android 13 | 33 |
| Android 12 | 32 |
| Android 12 | 31 |
| Android 11 | 30 |
| Android 10 | 29 |
| Android 9 | 28 |
| Android 8.1 | 27 |
| Android 8.0 | 26 |
| Android 7.1.1, 7.1 | 25 |
| Android 7.0 | 24 |
| Android 6.0 | 23 |
| Android 5.1 | 22 |
| Android 5.0 | 21 |
| Android 4.4 | 19 |
| Android 4.3 | 18 |
| Android 4.2, 4.2.2 | 17 |
| Android 4.1, 4.1.1 | 16 |
| Android 4.0.3, 4.0.4 | 15 |
| Android 4.0, 4.0.1, 4.0.2 | 14 |
| Android 3.2 | 13 |
| Android 3.1.x | 12 |
| Android 3.0.x | 11 |
| Android 2.3.4, 2.3.3 | 10 |
| Android 2.3.2, 2.3.1, 2.3 | 9 |
| Android 2.2.x | 8 |
| Android 2.1.x | 7 |
| Android 2.0.1 | 6 |
| Android 2.0 | 5 |
| Android 1.6 | 4 |
| Android 1.5 | 3 |
| Android 1.1 | 2 |
| Android 1.0 | 1 |