更新了ndk16.1版本后,再次编译的时候报错:
/ndk-bundle/build/core/setup-app.mk
Error:(81) Android NDK: Application targets deprecated ABI(s): armeabi mips mips64
Error:(82) Android NDK: Support for these ABIs will be removed in a future NDK release.
说明现在ndk已经不支持“armeabi, mips, mips64”这些架构了。
解决方法:
1. jni使用Cmake编译:
直接修改app/build.gradle,在cmake中添加abiFilter,如下:
externalNativeBuild {
cmake {
arguments '-DANDROID_TOOLCHAIN=clang',
'-DANDROID_STL=c++_static'
//abiFilters "arm64-v8a"
abiFilters 'arm64-v8a','armeabi-v7a','x86','x86_64'
}
}
2. jni使用mk文件编译:
删除Application.mk文件,或者修改Application.mk中的内容,将不支持的架构去掉即可,我修改成如下:
# select the ABI(s) to build for (see CPU-ARCH-ABIS.html in the NDK docs).
#APP_ABI := armeabi arm64-v8a x86 x86_64 mips mips64
APP_ABI := arm64-v8a x86 x86_64
APP_PLATFORM := android-19
按照stackoverflow中提供的方法还需要在app/build.gradle中的defaultConfig中添加abiFilters,但是我尝试不添加也可以编译通过