编译报错:
Unable to determine application id: com.android.tools.idea.run.ApkProvisionException: The currently selected variant "debug" uses split APKs, but none of the 1 split apks are compatible with the current device with ABIs "arm64-v8a".
原因:
不同的 Android 设备使用不同的 CPU,而不同的 CPU 支持不同的指令集。CPU 与指令集的每种组合都有专属的应用二进制接口 (ABI)。M1芯片的macbook pro则需要支持"arm64-v8a"的ABI;
解决:
配置build.gradle
:
android {
defaultConfig {
ndk {
abiFilters 'arm64-v8a', 'x86_64'
}
}
}
Android ABI详情,可以去官方文档查看:
https://developer.android.com/ndk/guides/abis#gradle