NDKBuild Failure

后端 未结 9 1166
伪装坚强ぢ
伪装坚强ぢ 2020-12-05 18:12

I\'m having trouble getting my NDK to compile properly in Android Studio. Whenever I try running to compile I am getting the following error.

Error:Ex

相关标签:
9条回答
  • 2020-12-05 18:16

    try this

    commandLine'E:\\Android\\ndk\\ndkbuild.cmd','-C',file('src/main/jni').absolutePath
    

    replace (E:\\Android\\ndk\\) with your ndk path.

    0 讨论(0)
  • 2020-12-05 18:18

    I met this kind of problem. First of all You have to give your NDK path in local.properties of your app.

    e.g. ndk.dir=/home/user/bin/android_ndk/android-ndk-r10e

    Then in my build.gradle file I had something like this for calling ndk build command.

    commandLine 'ndk-build', '-C', file('src/main/jni').absolutePath
    

    I'v change it to

    commandLine '/home/user/bin/android_ndk/android-ndk-r10e/ndk-build', '-C', file('src/main/jni').absolutePath
    

    I gave full path of NDK build. Hope it'll help you.

    0 讨论(0)
  • Have a look in these link below.

    You must know the path where the NDK is usually at

    Library/Android/sdk/ndk/<version_number>

    https://developer.android.com/studio/releases?utm_source=android-studio#4-0-0-ndk-dir

    and

    https://developer.android.com/studio/projects/install-ndk

    and

    https://wiki.appcelerator.org/display/guides2/Installing+the+Android+NDK

    0 讨论(0)
  • 2020-12-05 18:33

    its easy for android studio 2.3.3. just follow File->Project Structure -> android NDK Location-> Click download button. after install ndk solve my problem.

    0 讨论(0)
  • 2020-12-05 18:35

    The accepted answer is OK, but it doesn't work since android tools gradle plugin 2.3: No sdkHandler field in LibraryPlugin after updating to build tools 2.3.0, so you need to use project.android.ndkDirectory.absolutePath variable then, ie:

    task ndkBuild(type: Exec) {
        commandLine project.android.ndkDirectory.absolutePath + '/ndk-build', '-C', file('src/main/jni/').absolutePath
    }
    

    Alternatively you can read ndk.dir directly from local.properties: https://stackoverflow.com/a/32649204/1028256

    0 讨论(0)
  • 2020-12-05 18:38
    1. First of all you have to check local.properties file in your project. In local.properties check ndk path. It looks like this ndk.dir=D:\\sdk\\ndk-bundle.

    2. Now go to the build.gradle(Module library) and find getNdkPath(). It will return ndk path location which concatnate the ndk-build

    3. Change ndk-build --> ndk-build.cmd. It looks like this:

    Hope it will help you!

    0 讨论(0)
提交回复
热议问题