Android Studio 1.4无法启动调试服务器。

3

我已经使用AS 1.4工作了一段时间,新的本地调试功能特别有用。

但是本地调试在我的三星Galaxy Note 10.1 2014 (Android 4.4)上不起作用。当我尝试启动本地调试会话时,会看到以下消息:

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

我还发现了一个开放问题: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
有办法解决这个问题吗?
2个回答

3
请参考https://code.google.com/p/android/issues/detail?id=187003
您需要获得设备的root权限,然后使用chmod 4750 /system/bin/run-as来解决问题。
如果您没有root权限,则可以修改您的应用程序,并使用您包的标识启动LLDB服务器,使用Runtime.exec()

我尝试过了,但没有帮助。我设法更改了run-as的权限:-rwsr-x--- root shell 9500 2015-03-25 21:42 run-as,但现在我收到完全相同的错误消息。 - Aleksei Petrenko
我应该尝试你建议的第二种方法。你知道在哪里可以找到更多关于Runtime.exec()方法的细节吗? - Aleksei Petrenko
1
这篇文章非常好,深入地描述了过程:http://ian-ni-lewis.blogspot.co.il/2011/05/ndk-debugging-without-root-access.htm。它有点老,谈到了gdb,但今天仍然非常相关。 - Alex Cohn
1
你尝试过使用 setxattr /system/bin/run-as security.capability 吗? - Alex Cohn

1

我遇到了Android Studio 3.5与LLDB调试器类似的问题 - "Starting LLDB server"进程永远挂起,没有调试进程启动,解决了这个问题后我又遇到了另一个问题。关于这些问题的解决方法在我提交的错误报告中有说明:

  1. Android Studio C++调试器启动时静默忽略手机LLDB设置关键问题 - 解决方法:确保使用基于Google API而不是Google Play(无root访问)的AVD模拟器。
  2. Android Studio C++调试器在LLDB设置过程中在手机上使用错误路径导致:无法获取握手数据包的回复 - 解决方法:检查哪些路径错误,并在设备上创建它们,例如:mkdir -p .../bin

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接