Android运行时报错:Flag android.useDeprecatedNdk is no longer supported and will be removed in the next...
报错详细信息如下
Flag android.useDeprecatedNdk is no longer supported and will be removed in the next version of Android Studio. Please switch to a supported build system.Consider using CMake or ndk-build integration. For more information,
原因
android.useDeprecatedNdk 将不再被支持,建议我们使用Cmake或ndk-build。因此我们需要取消使用useDeprecatedNdk ,并使用ndk-build
解决方法*
在gradle.properties中,注释掉android.useDeprecatedNdk=true。接着再运行又会报出如下错误:
Your project contains C++ files but it is not using a supported native build system.Consider using CMake or ndk-build integration. For more information, go to:xxx
意思就是使用需要使用ndk-build,在module的build.gradle android节点下添加:
// ndk-build模式
externalNativeBuild {ndkBuild {// Provides a relative path to your ndkBuild script.path file("src/main/jni/Android.mk")}
}
接着再编译会报出如下错误,意思是平台不再支持ABI[Armeabi]。支持的ABI有[ARM64-V8A、ARMEABI-V7A、x86、x86 64]
ABIs [armeabi] are not supported for platform. Supported ABIs are [arm64-v8a, armeabi-v7a, x86, x86_64]
在module的build.gradle android—defaultConfig节点下ndk的abiFilters 设置为armeabi-v7a,问题即可解决。
ndk {// abiFilters "armeabi"abiFilters "armeabi-v7a"
}
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
