在将 Android Studio 更新到1.3.0版本之后,我得到了“ NDK 集成在当前插件中不被推荐”错误

我已经更新了我的 Android 工作室的版本 1.3.0之前3天。

在此之前,我可以使用 NDK,现在我得到的错误像,

错误: (50,0)错误: NDK 集成在当前插件中不被推荐。考虑尝试新的实验性插件。有关详细信息,请参阅 http://tools.android.com/tech-docs/new-build-system/gradle-experimental。在 gradle.properties 中设置“ android.useDeprecatedNdk = true”以继续使用当前的 NDK 集成。

我在项目级找不到 gradle.property 文件。

我如何解决这个错误?

73517 次浏览

Here is how to solve this issue :

  1. add gradle.properties file to root folder of your project
  2. add 'android.useDeprecatedNdk=true' to gradle.properties file

Here is my gradle.properties :

# Project-wide Gradle settings.


# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.


# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html


# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8


# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true


android.useDeprecatedNdk=true

And add it to root of your project :

location of gradle.properties

And rebuild your project. Thats it.

It mostly happens when you migrate your project from eclipse to Android studio, Or when you simply import eclipse project in android studio.

One more issue while getting this error, Mostly you dont have the file which named "gradle.properties" you need to create/add in the project first and then set

android.useDeprecatedNdk=true

Deprecated NDK is no longer supported. To avoid that error remove android.useDeprecatedNdk=true and do not make any white space in the Project Directory. If errors come again then edit the build.gradle(Module:app) and add those line like below:

 buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { jni.srcDirs = ['src/main/jni/','src/main/jniLibs/'] } }
externalNativeBuild {
ndkBuild {
path 'build/intermediates/ndk/debug/Android.mk'
}
}

Here is how to solve this issue :

Go to gradle.properties file to root folder of your project Remove android.useDeprecatedNdk=true from your gradle.properties file

Android has removed android.useDeprecatedNdk so it won't work anymore