【发布时间】:2015-11-05 06:19:45
【问题描述】:
我想用 android studio 调试 c++ ndk 但是 当我创建“Android Native”运行配置时,我收到错误“构建类型不是 jni 可调试”。 我的 build.gradle :
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'
}
我的配置:
我可以运行 c++ ndk 但无法调试
我能做什么?
【问题讨论】:
标签: android android-ndk