android studio 2.2.2/2.3 调试ndk遇到的一个奇怪问题

来源:互联网 发布:农业科技网络书屋app 编辑:程序博客网 时间:2024/06/05 22:54

有哪个大神帮我解决这个问题。

我的Android studio 工程 :http://download.csdn.net/detail/caizhigui/9801055

工程做了事情

NDK开发-之1——as2.3中新建工程自定义方法及日志打印


下面开始问题描述:



我在笔记本上可以正常调试一切都ok(用模拟器测试)


可是在pc上安装一样的环境,就是死活进不了C++ 代码的调试。(同一个android stuido 工程)

ndk工程下载地址:http://download.csdn.net/detail/caizhigui/9801055

CzgLenrnNDKTest


======console刚开始提示:



04/01 10:55:26: Launching app
No apk changes detected since last installation, skipping installation of E:\czg\czgAs\CzgLenrnNDKTest\app\build\outputs\apk\app-debug.apk
$ adb shell am force-stop czg.com.czglenrnndktest
$ adb shell am start -n "czg.com.czglenrnndktest/czg.com.czglenrnndktest.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Connecting to czg.com.czglenrnndktest
Now Launching Native Debug Session
Starting LLDB server: /data/local/tmp/lldb/bin/start_lldb_server.sh /data/local/tmp/lldb unix-abstract /data/local/tmp/lldb/tmp platform-1491015327774.sock "lldb process:gdb-remote packets"
$ adb shell cat /data/local/tmp/lldb-server | sh -c 'cat > /data/local/tmp/lldb/bin/lldb-server && chmod 700 /data/local/tmp/lldb/bin/lldb-server'
$ adb shell cat /data/local/tmp/start_lldb_server.sh | sh -c 'cat > /data/local/tmp/lldb/bin/start_lldb_server.sh && chmod 700 /data/local/tmp/lldb/bin/start_lldb_server.sh'

======console  ===然后提示  =(死活进不了c++断点,可以进入java断点)

Connected to the target VM, address: 'localhost:8649', transport: 'socket'





=====可以调试的情况



不能调试的情况:



更改这个jkd也是不行,奇怪


这是可以调试的控制台信息:

No apk changes detected since last installation, skipping installation of D:\AndroidStudioApp\CzgLenrnNDKTest\app\build\outputs\apk\app-debug.apk
$ adb shell am force-stop czg.com.czglenrnndktest
$ adb shell am start -n "czg.com.czglenrnndktest/czg.com.czglenrnndktest.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Connecting to czg.com.czglenrnndktest
Now Launching Native Debug Session
Starting LLDB server: /data/local/tmpdb/bin/start_lldb_server.sh /data/local/tmpdb unix-abstract /data/local/tmpdb/tmp platform-1491021708955.sock "lldb process:gdb-remote packets"
$ adb shell cat /data/local/tmpdb-server | sh -c 'cat > /data/local/tmpdb/bindb-server && chmod 700 /data/local/tmpdb/bindb-server'
$ adb shell cat /data/local/tmp/start_lldb_server.sh | sh -c 'cat > /data/local/tmpdb/bin/start_lldb_server.sh && chmod 700 /data/local/tmpdb/bin/start_lldb_server.sh'
Debugger attached to process 15299

不可调试的控制台信息:

No apk changes detected since last installation, skipping installation of E:\czg\czgAs\CzgLenrnNDKTest\app\build\outputs\apk\app-debug.apk
$ adb shell am force-stop czg.com.czglenrnndktest
$ adb shell am start -n "czg.com.czglenrnndktest/czg.com.czglenrnndktest.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Connecting to czg.com.czglenrnndktest
Now Launching Native Debug Session
Starting LLDB server: /data/local/tmp/lldb/bin/start_lldb_server.sh /data/local/tmp/lldb unix-abstract /data/local/tmp/lldb/tmp platform-1491015327774.sock "lldb process:gdb-remote packets"
$ adb shell cat /data/local/tmp/lldb-server | sh -c 'cat > /data/local/tmp/lldb/bin/lldb-server && chmod 700 /data/local/tmp/lldb/bin/lldb-server'
$ adb shell cat /data/local/tmp/start_lldb_server.sh | sh -c 'cat > /data/local/tmp/lldb/bin/start_lldb_server.sh && chmod 700 /data/local/tmp/lldb/bin/start_lldb_server.sh'


认真看没有什么差别:

google找:unable to debug ndk with android stuido

stackoverflow论坛上也有人提出了这个问题
http://stackoverflow.com/questions/32684845/how-to-switch-between-lldb-and-gdb-in-android-studio
http://stackoverflow.com/questions/40595702/problems-debugging-native-code-in-android-studio-2-2-1-lldb2-2-and-ndk13

同类问题
http://stackoverflow.com/questions/39407587/android-native-debug-compiled-with-externalnativebuild-ndkbuild

国内作者解决方案(低版本都可以实现,真是高手)

http://www.jianshu.com/p/178a2169b7ff

http://www.jianshu.com/p/7844aafe897d

这个大神的android 工程我下载下载不能用提示cpu的类型问题(那么我的模拟器是不是跟cpu类型有关呢)


查阅了大量文献,没有解决方案

谷歌的:Create and Edit Run/Debug Configurations

谷歌的调试你的应用:https://developer.android.com/studio/debug/index.html#breakPoints

谷歌的android ndk 教程:https://developer.android.com/ndk/index.html

谷歌ndk实例:https://github.com/googlesamples/android-ndk


问题解决:之前的所以操作都是在虚拟机上调试,后来抱着侥幸的心理用手机测试既然可以,不过调试速度非常慢。等待网友的解决方案。


0 0