Android studio 生成so文件编译后报错

Android运行时报错:Flag android.useDeprecatedNdk is no longer supported and will be removed in the next...
原创梦回河口 最后发布于2019-07-11 19:12:10 阅读数 450 收藏
展开
报错详细信息如下
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,
1
原因
  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
1
  意思就是使用需要使用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]
1
  在module的build.gradle android—defaultConfig节点下ndk的abiFilters 设置为armeabi-v7a,问题即可解决。

ndk {
// abiFilters "armeabi"
abiFilters "armeabi-v7a"
}

版权声明:本文为CSDN博主「梦回河口」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/zxc514257857/article/details/95507073

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容