简体   繁体   中英

NDK in Android studio with experimental gradle 0.2.0

I want to use NDK in Android Studio. For that i am following the Experimental gradle http://tools.android.com/tech-docs/new-build-system/gradle-experimental I need to get NDK path in my project -> app -> build.gradle

But when I am trying it like this :-

def ndkDir = plugins.getPlugin('com.android.model.application').getNdkFolder()

Gradle build fails with the following error :-

Error:(75, 0) No signature of method: com.android.build.gradle.model.AppComponentModelPlugin.getNdkFolder() is applicable for argument types: () values: []

Can anyone tell me the correct way to proceed with it ?

I am using :-

  • Android Studio 1.3
  • Gradle2.5 "distributionUrl=https://services.gradle.org/distributions/gradle-2.5-all.zip"
  • classpath 'com.android.tools.build:gradle-experimental:0.2.0'

I had not a similar problem, but a related one, I think..

Try File->settings-> Build, Execution, Deployment-> Gradle and select Use default gradle wrapper .

That did it for me. Apparently changing distributionUrl isn't enough..

Edit:

Also, the latest update bundles the NDK with the SDK. Open the SDK Manager, and download the NDK bundle from there. I've seen numerous cases where that simple change did the trick. Also, why don't you just type in the static path to your NDK, which will cause your problem to go away?...

Yes I have specified the NDK path statically in the build.gradle

def ndkDir = '/path/to/ndk'

with this gradle sync is successful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM