dae*_*mie 9 debugging android cmake android-ndk android-studio
我在调试库模块的C++文件时遇到问题.
一般来说这可能吗?
如果应用程序项目包含c ++代码,则调试工作正常.但我想将C++代码移动到库模块.
启动会话时出现错误消息:
现在启动本机调试会话
注意!找不到符号目录 - 请检查您的本机调试配置
我的lib的gradle文件:
apply plugin: 'com.android.library'
android {
compileSdkVersion 24
buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
externalNativeBuild {
cmake {
arguments "-DANDROID_PLATFORM_LEVEL=${11}",
'-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=gnustl_static'
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-annotations:24.2.0'
}
Run Code Online (Sandbox Code Playgroud)
在运行配置中,调试器设置为auto
加法:
我正在使用:
Gradle:2.2.3
Android Studio:2.2.3
在LLLB控制台中,我检查了断点列表:
断点列表-v
我的所有检查站都列在那里.
不工作的断点
1: file = 'C:\android-dev\...\test.cpp', line = 19, exact_match = 0
Run Code Online (Sandbox Code Playgroud)
..就这样
工作断点
1: file = 'C:\android-dev\...\test.cpp', line = 19, exact_match = 0
1.1:
module = C:\android-dev\...\test.so
compile unit = gl_code.cpp
function = testFunc(..)
location = C:\android-dev\...\test.cpp:16
address = 0x0000007f871d068c
resolved = true
hit count = 1
Run Code Online (Sandbox Code Playgroud)
原因似乎是,创建了lib的发布版本,它不支持调试.即使应用程序是使用调试选项构建的.
解:
要解决此问题,请执行以下解决方法.它确保构建调试版本.
在您的应用内部build.gradle更改:
compile project(':nativelib')
Run Code Online (Sandbox Code Playgroud)
至
compile project(path: ':nativelib' , configuration: 'debug')
Run Code Online (Sandbox Code Playgroud)
在libs build.gradle中添加:
android {
publishNonDefault true //this line
compileSdkVersion 24
buildToolsVersion "25.0.2"
defaultConfig {
...
}
...
}
Run Code Online (Sandbox Code Playgroud)
更新:
有关更新,请参阅相应的Google问题:
https://code.google.com/p/android/issues/detail?id=222276
我遇到了同样的错误(“注意!找不到符号目录 - 请检查您的本机调试配置。”)。我的解决方案是(Android Studio 3.2):
跑 ?编辑配置?“调试器”选项卡?将您的工作路径添加到符号目录。
| 归档时间: |
|
| 查看次数: |
8719 次 |
| 最近记录: |