Execution failed for task ':app:compileDebugNdk'

后端 未结 3 1605
野的像风
野的像风 2020-12-16 03:22

I\'m using the latest android studio build 1.1 ,since i want to import an eclipse project that needs NDK .i installed NDK and set the NDK location in the local.propert

相关标签:
3条回答
  • 2020-12-16 03:59

    Try adding this to the build.gradle file:

    sourceSets.main {
       jni.srcDirs = []
    }
    
    0 讨论(0)
  • May be this is known NDK bug. Try to add empty .c file to your jni dir (like empty.c).

    0 讨论(0)
  • 2020-12-16 04:03

    This solved my problem:

    • If you don't have th JNI directory in your project, create it:

    enter image description here

    • Go to the new JNI directory that you just created. It should be in{approot}\app\src\main\jni

    enter image description here

    • Create an empty *.c file

    enter image description here

    • Add the following code to your app/gradle.build file, in the android section. It should look like this:

      android {
          ...
          sourceSets.main {
              jniLibs.srcDir 'libs'
              jni.srcDirs = [] //disable automatic ndk-build call
          }
      }
      
    0 讨论(0)
提交回复
热议问题