2015-11-05 12 views
8

मैं एंड्रॉइड स्टूडियो के साथ सी ++ एनडीके डीबग करना चाहता हूं लेकिन जब मैं "एंड्रॉइड नेटिव" रन कॉन्फ़िगरेशन बनाता हूं, तो मुझे त्रुटि मिलती है "बिल्ड प्रकार jni डिबगबल नहीं है"। मेरी 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

शुरुआत के लिए, मैं एंड्रॉयड स्टूडियो 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 
} 
enclosing buildTypes

करने के लिए

लेकिन इस वाक्य रचना, भिन्न होता है अपने Gradle संस्करण के आधार पर। Here और here अन्य ग्रेडल संस्करणों

+0

के साथ सहायता के लिए देखें यह मेरे लिए काम करता है। एंड्रॉइड स्टूडियो 2.0/ग्रैडल 2.1 –

+0

'jniDebuggable' एनडीके बिल्ड के लिए क्रमिक-प्रयोगात्मक में मान्य नहीं है। –

संबंधित मुद्दे