Error: NDK integration is deprecated in the current plugin. Consider try the new experimental plugin

跑某个大厂的demo时,说明一下项目的配置(特殊配置)app目录下有个jni文件,jni文件里面包含.c和.cpp以及.h文件(都是c文件)报了如上错:错误详情如下

Error: NDK integration is deprecated in the current plugin.  Consider trying the new experimental plugin.  For details, see http://tools.android.com/tech-docs/new-build-system/gradle-experimental.  Set "$USE_DEPRECATED_NDK=true" in gradle.properties to continue using the current NDK integration.

按照报错提示:在gradle.properties设置添加:USE_DEPRECATED_NDK=true,但是仍然不管用。

有个简单粗暴的方法就是:直接删除相关的c文件代码,即可正常运行

但是我们时文明人,有更温和的办法解决:
第一步:在jni文件下,新建一个空的.c文件
第二步:在主工程下 build.gradle中添加如下代码即可完美解决问题

sourceSets.main {
        jniLibs.srcDir 'libs'
        jni.srcDirs = []
    }

猜你喜欢

转载自blog.csdn.net/willba/article/details/80270794