我使用 AS 1.4 已经有一段时间了,新的 native 调试功能特别有用。
但是 native 调试不适用于我的 Samsung Galaxy Note 10.1 2014 (Android 4.4)。当我尝试启动 native 调试 session 时,我看到以下消息:
Starting LLDB server: run-as com.example.hellojni /data/data/com.example.hellojni/lldb/bin/start_lldb_server.sh /data/data/com.example.hellojni/lldb /data/data/com.example.hellojni/lldb/tmp/platform.port1445003703353 "lldb process:gdb-remote packets"
Error while launching debug server on device: com.android.tools.ndk.run.DebuggerContext$StartServerException: java.lang.IllegalStateException:
Failed to read platform port /data/data/com.example.hellojni/lldb/tmp/platform.port1445003703353
我还发现了一个 Unresolved 问题:https://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&groupby=&sort=&id=185061
有办法解决吗?
最佳答案
参见 https://code.google.com/p/android/issues/detail?id=187003
您的设备需要 root 权限,但随后 chmod 4750/system/bin/run-as
可能会解决问题。
如果您没有 root 访问权限,您可以修改您的应用程序,并使用 Runtime.exec()
使用您的包的身份启动 LLDB 服务器。
关于Android Studio 1.4 无法启动调试服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33172427/