2017-01-05 12 views
1

私はebookdroid & MuPDF CPPファイルを使用してPDFビューアアプリケーションに取り組んでいます。私はGradleのNDK統合に関する多くの問題を抱えています。私は多くの答えを見てきましたが、私の問題は解決していません。GradleでNDKのlibパスを設定するには?

のGradleは私に次のエラーメッセージ与えている

Error:Execution failed for task ':app:compileDebugNdk'. 
Error: Your project contains C++ files but it is not using a supported native build system. 
Consider using CMake or ndk-build integration with the stable Android Gradle plugin: 
    https://developer.android.com/studio/projects/add-native-code.html 
    or use the experimental plugin: 
    http://tools.android.com/tech-docs/new-build-system/gradle-experimental. 

答えて

0

編集しbuild.gradleを、sourceSet.main.jni.srcDir defaultConfig.externalNativeBuild.ndkBuildexternalNativeBuild.ndkBuildを追加オプション。以下のコメントを参照してください。

android { 
     compileSdkVersion 22 
     buildToolsVersion "27.0.0" 

     defaultConfig { 
      minSdkVersion 18 
      targetSdkVersion 22 
      versionCode 1 
      versionName "1.0" 

      //add arguments passed to ndkBuild 
      externalNativeBuild { 
       ndkBuild { 
        arguments "NDK_TOOLCHAIN_VERSION=clang", "APP_SHORT_COMMANDS=true", "APP_ALLOW_MISSING_DEPS=true" 
        arguments "-j" + Runtime.runtime.availableProcessors() 
        cFlags "-fexceptions" 
       } 
      } 

      ndk { 
       abiFilters "armeabi-v7a" 
      } 
     } 

     //specify jni source file path 
     sourceSets.main { 
      java.srcDir "src" 
      res.srcDir "res" 
      jni.srcDir "jni" 
     } 


     buildTypes { 
      debug { 
       debuggable true 
       jniDebuggable true 
      } 
     } 

     //specify makefile/CMake file 
     externalNativeBuild { 
      ndkBuild { 
       path 'jni/Android.mk' 
      } 
     } 
    } 
関連する問題