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

你可能感兴趣的:(Android studio 生成so文件编译后报错)