

English
The Android platform configures the CPU type for the so library developed and generated using the C/C++ language in order to improve the operating efficiency. It is necessary to compile and generate the corresponding instruction so library for each CPU type platform separately. The code developed in the Java language runs in the virtual machine, and the virtual machine adapts the CPU type, which does not involve this problem.
Functions (modules) using the so library in HBuilder/HBuilderX
HBuilderX2.7.0+ 调整 云端打包默认不再包含 x86 CPU类型库,减少apk包体积详情 HBuilderX2.1.5+ began to support the new 64-bit CPU type for Android platform, and cloud package supports configuration of CPU types supported by App Meet the requirement that apps uploaded on Google Play from August 1, 2019 must support 64-bit CPU.
HBulderX has been adapted to support the following mainstream CPU types:
不支持64位x86指令cpu,即不支持x86_64
Note: If x86 is not checked, it may not work properly on the emulator. The following are common emulators that need to include x86
可视化界面配置
源码视图配置 Open the manifest.json file of the project, switch to the "source view", and configure according to the project type
"app-plus": {
"distribute": {
"android": {
"abiFilters": [
"armeabi-v7a",
"arm64-v8a"
]
//...
},
//...
},
//...
},
//..
Use Android studio to open the Android native project and open the build.gradle file of the corresponding project. 在Android -> defaultConfig下添加支持的CPU类型,如下示例:
defaultConfig{
ndk {
abiFilters 'arm64-v8a','armeabi-v7a'
}
}
Note: Offline packaging only supports three types: arm64-v8a, armeabi-v7a, and x86. It is recommended to choose the type of CPU packaged according to your needs
ARM64-bit (arm64-v8a) CPU is compatible with ARM32 instructions, that is to say, only the so library of type armeabi-v7a can also run on 64-bit mobile phones, but it does not fully utilize the performance of the CPU. 选择支持的CPU类型时请参考以下建议:
部分华为新设备(Mate60、Mate X5等)使用的芯片运行32位应用时只能跑在小核上,相当于限制的CPU的性能,如果应用只包含armeabi-v7a会导致应用启动速度非常慢。需要勾选arm64-v8a来解决此问题。 为了适配更多的新设备,建议开发者尽量勾选arm64-v8a。
如果勾选了不支持x86的内置模块或uni原生插件,云端打包后不会包含x86
提交Google Play时要求支持64位,建议选择"armeabi-v7a"和"arm64-v8a"两个即可,也可以只选择"arm64-v8a"。
Note: Do not check "x86"
If the CPU type selected by the package is not compatible with the device, it will not be installed normally. Installation through adb command usually prompts the following error:
Performing Streamed Install
adb: failed to install android_debug.apk: Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]
At present, common mobile phones on the market use ARM processors, and few devices use x86 processors. Therefore, starting from HBuilderX2.7.0, cloud packaging is adjusted to no longer contain x86 CPU types by default, reducing the size of the apk package:
Note: Most emulators (like Nox) must include x86, otherwise the app may start with a white screen, please configure it according to the tutorial above