i want to debug c++ ndk with android studio but when i create a "Android Native" run configuration, I get the error "Build type isn't jni debuggable". my 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'
}
my configuration:
i can run c++ ndk but cant debug that
what i can do?
Although the debug build type doesn't appear in the build configuration file, Android Studio configures it with debuggable true. This allows you to debug the app on secure Android devices and configures app signing with a generic debug keystore. You can add the debug build type to your configuration if you want to add or change certain settings.
@rkrishnan2012 yes, you have to add isJniDebuggable to the debug {} section in build.gradle, see: #20 Sorry, something went wrong. FYI the new syntax with gradle-experimental-0.2.0 is:
This a JNI error has occurred Minecraft server error occurs when you try to start Minecraft or a Minecraft server on a PC that does not have the latest version installed. To fix this, you just need to update your current Java to the latest version. You can complete the installation of Java’s latest version of Minecraft by following these steps:
For example, to create just the java/ directory for your "debug" build type: Open the Project pane and select the Project view from the drop-down menu at the top of the pane. Navigate to MyProject/app/src/. Right-click the src directory and select New > Folder > Java Folder. From the drop-down menu next to Target Source Set, select debug.
For starters, I'm using Android Studio 1.5 / gradle 2.8
I fixed this by changing my build.gradle
to
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
ndk {
debuggable = true
}
}
debug {
debuggable = true
jniDebuggable = true
}
}
So, basically, I just added the lines
ndk {
debuggable = true
}
To release, and
debug {
debuggable = true
jniDebuggable = true
}
To the enclosing buildTypes
But this syntax varies, based on your gradle version. Look Here and here for help with other gradle versions
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With