2015-11-05 19 views
8

アンドロイドスタジオでC++ ndkをデバッグしたいが、 "Android Native"実行コンフィギュレーションを作成すると "Build type is not jni debuggable"というエラーが出る。 私のbuild.gradle:ビルドタイプがjniデバッグ可能でないエラー

import org.apache.tools.ant.taskdefs.condition.Os 
apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.1" 

    defaultConfig { 
     applicationId "org.amk.test" 
     minSdkVersion 11 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 


     ndk { 
      moduleName "HelloJNI" 
     } 
     sourceSets.main { 
      jniLibs.srcDir 'src/main/libs' 
      jni.srcDirs = [] //disable automatic ndk-build call 
     } 
     task ndkBuild(type: Exec) { 
      if (Os.isFamily(Os.FAMILY_WINDOWS)) { 
       commandLine 'ndk-build.cmd', '-C', 'main','NDK_DEBUG=1' 
      } else { 
       commandLine 'ndk-build', '-C', file('src/main/jni').absolutePath 
      } 
     } 

     tasks.withType(JavaCompile) { 
      compileTask -> compileTask.dependsOn ndkBuild 
     } 
    } 

    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
     release { 
      ndk { 
       debuggable = true 
      } 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.android.support:appcompat-v7:23.0.1' 
    compile 'com.android.support:support-v4:23.0.1' 
    compile 'com.android.support:palette-v7:23.0.1' 
    compile 'com.android.support:cardview-v7:23.0.1' 
    compile 'com.android.support:recyclerview-v7:23.0.1' 
    compile 'com.jakewharton:butterknife:6.1.0' 
} 

私の設定:

enter image description here

私はC++ NDKが、私は何ができるか

カントのデバッグを実行できますか?手始めに

答えて

12

、私はAndroidのメーカー1.5/Gradleの2.8

を使用している私は、だから私のbuild.gradle

から
buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
      ndk { 
       debuggable = true 
      } 

     } 
     debug { 
      debuggable = true 
      jniDebuggable = true 
     } 

    } 

を変更することで、これを固定し、基本的に、私はちょうどライン

を追加しました
ndk { 
     debuggable = true 
} 

リリースするには

debug { 
     debuggable = true 
     jniDebuggable = true 
} 
囲む buildTypes

しかし、この構文は、あなたのGradleのバージョンに基づいて、変化します。 Herehere他のグラデーションバージョンのヘルプ

+0

それは私のために働いた。 Android Studio 2.0/Gradle 2.1 –

+0

'jniDebuggable'はNDKビルドのためにgradle-experimentalで有効ではありません。 –

関連する問題