【发布时间】:2016-05-07 17:36:03
【问题描述】:
我最近在 android studio 上更新到 android studio 2.1 AI-143.2790544。在以前的版本中,NDK 调试功能正常,允许我单步执行代码。
更新后,每当调试器在断点处停止时,调试器就会在 JDWP 线程上停止,并且显示的堆栈帧是:
art::MallocAllocator::~MallocAllocator()
art::JDWP::JdwpState::HandlePacket()
art::JDWP::JdwpAdpState::ProcessIncoming()
art::JDWP::JdwpState::Run()
art::JDWP::StartJdwpThread(void *)
__pthread_start(void *)
__start_thread
这对我的工作流程非常不利。为了解决这个问题,我必须将线程更改为我的代码库中存在的线程。
目前在 Galaxy S7、Nexus 5 和 x86 Nexus 5 模拟器上调试时会出现同样的问题。
我的 gradle 构建文件具有以下构建属性集:
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion = 18
buildToolsVersion = "24.0.0 rc2"
defaultConfig.with {
applicationId = "..."
minSdkVersion.apiLevel = 18
targetSdkVersion.apiLevel = 18
versionCode = 1
versionName = "1.0"
}
compileOptions.with {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
}
android.ndk {
moduleName = "coconuteng"
stl = "gnustl_static"
def libs = [
"log",
"android",
"EGL",
"GLESv3",
"jnigraphics",
"dl"
];
def includes = [
"-I${projectDir}/src/main/jni/engine/include".toString(),
"-I${projectDir}/src/main/jni/engine/glm".toString(),
"-I${projectDir}/src/main/jni/engine/lua".toString(),
"-I${projectDir}/src/main/jni/android_app_glue".toString(),
"-I${projectDir}/src/main/jni/engine/platforms/android".toString(),
"-I${projectDir}/src/main/jni/engine/platforms".toString()
];
def flags = [
"-DGL_V_3",
"-DUSE_ANDROID",
"-DANDROID_NDK",
"-DFT2_BUILD_LIBRARY",
"-DDEBUG_SHADERS"
];
ldLibs.addAll(libs)
CFlags.addAll(flags)
CFlags.addAll(includes)
cppFlags.addAll(flags)
cppFlags.add("-std=c++11")
cppFlags.addAll(includes)
}
android.buildTypes {
release {
minifyEnabled = false
signingConfig = $.android.signingConfigs.get("release")
}
debug {
debuggable = true
applicationIdSuffix = ".debug"
}
}
android.signingConfigs {
create("release") {
keyAlias = "..."
keyPassword = "..."
storeFile = file("release-key.keystore")
storePassword = "..."
storeType = "jks"
}
}
// You can modify the NDK configuration for each variant.
components.android {
binaries.afterEach { binary ->
// String localProjectDir = "-L\""+projectDir.toString()+"/src/main/ldLibs/" + binary.name.toString() + "\""
// binary.mergedNdkConfig.cppFlags.add(localProjectDir)
binary.mergedNdkConfig.cppFlags.add(
"-DVARIANT=\"" + binary.name + "\"")
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.amazonaws:aws-android-sdk-core:2.+'
compile 'com.amazonaws:aws-android-sdk-s3:2.+'
}
我的 Gradle 包装器:
#Mon Oct 19 22:06:39 EDT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
local.properties:
java.runtime.version=1.6
ndk.dir=/home/julian/Android/Sdk/ndk-bundle
sdk.dir=/home/julian/Android/Sdk
还有我项目的 build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle-experimental:0.6.0'
}
}
allprojects {
repositories {
jcenter()
}
}
任何有关此问题的帮助将不胜感激。
【问题讨论】:
-
我也有同样的问题。找到解决方案了吗?
标签: android debugging android-studio android-ndk ide