gpt4 book ai didi

android-studio-3.0 - C/C++ 调试器在 Android Studio 3.0.1 上不起作用

转载 作者:行者123 更新时间:2023-12-02 02:56:19 37 4
gpt4 key购买 nike

双调试(C/C++和Java)在Android Studio 2.3.3中正常工作 minSdkVersion: 22, targetSdkVersion/compileSdkVersion: 26。

当我更新到 Android Studio 3.0.1 ,然后 Java调试器正常但是 C/C++ 调试器不起作用 .我在 Java 和 C/C++ 调试器之间分别测试它以找出哪个调试器不工作。

问题是 C/C++ 调试器不起作用 在 Android Studio 3.0.1 上。发生了这样的错误:

failed to get reply to handshake packet com.jetbrains.cidr.execution.debugger.backend.lldb.LLDBDriverException: failed to get reply to handshake packet at com.jetbrains.cidr.execution.debugger.backend.lldb.LLDBDriver$ThrowIfNotValid.throwIfNeeded(LLDBDriver.java:143) at com.android.tools.ndk.run.lldb.AndroidLLDBDriver.connectPlatform(AndroidLLDBDriver.java:308) at com.android.tools.ndk.run.lldb.AndroidLLDBDriver.loadForLaunch(AndroidLLDBDriver.java:158) at com.android.tools.ndk.run.lldb.AndroidLLDBDriver.loadForAttach(AndroidLLDBDriver.java:199) at com.android.tools.ndk.run.AndroidNativeAppDebugProcess.prepareTarget(AndroidNativeAppDebugProcess.java:98) at com.android.tools.ndk.run.AndroidNativeDebugProcess.doStart(AndroidNativeDebugProcess.java:113) at com.jetbrains.cidr.execution.debugger.CidrDebugProcess$3.run(CidrDebugProcess.java:307) at com.jetbrains.cidr.execution.debugger.CidrDebugProcess$MyCommandProcessor.consume(CidrDebugProcess.java:724) at com.jetbrains.cidr.execution.debugger.CidrDebugProcess$MyCommandProcessor.consume(CidrDebugProcess.java:714) at com.intellij.util.concurrency.QueueProcessor.lambda$null$0(QueueProcessor.java:106) at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:223) at com.intellij.util.concurrency.QueueProcessor.lambda$wrappingProcessor$1(QueueProcessor.java:106) at com.intellij.util.concurrency.QueueProcessor.lambda$null$2(QueueProcessor.java:203) at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:223) at com.intellij.util.concurrency.QueueProcessor.lambda$startProcessing$3(QueueProcessor.java:203) at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:334) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)



如何解决这个问题呢?

最佳答案

我使用了 AVD Pixel 2 XL API 22 - x86 - Google API(可以 Root )并遇到同样的问题“无法获得对握手数据包的回复”,日志如下:

Launching 'setMeasurement() (1)' on Pixel 2 XL API 22 - x86 - Google API 
Running tests

$ adb shell am instrument -w -r -e debug true -e \
class 'com.my.package.MyClassTest#setMeasurement' \
com.my.package.test/androidx.test.runner.AndroidJUnitRunner

Waiting for application to come online: com.my.package | com.my.package.test
...
Waiting for application to come online: com.my.package | com.my.package.test

Connecting to com.my.package.test
Now Launching Native Debug Session

$ adb shell cat /data/local/tmp/lldb-server \
| sh -c 'cat > /data/data/com.my.package/lldb/bin/lldb-server
\ && chmod 700 /data/data/com.my.package/lldb/bin/lldb-server'

$ adb shell cat /data/local/tmp/start_lldb_server.sh \
| sh -c 'cat > /data/data/com.my.package/lldb/bin/start_lldb_server.sh \
&& chmod 700 /data/data/com.my.package/lldb/bin/start_lldb_server.sh'

Starting LLDB server:
failed to get reply to handshake packet

所以我试图重复这些命令(adb shell + 本地运行的命令) - 最后两个 adb shell 命令失败了。检查电话文件目录结构我发现:
  • 在用于设置 ldb-server 的 adb 命令中,目标路径是错误的,它是“/data/data/com.my.package”并且 APK 位于/data/app/com.my.package-2(后缀 -2 是可能是动态创建的)
  • 文件夹 .../lldb/bin/也不存在
  • adb 命令显然失败了,因为文件夹和文件没有在模拟器上复制/设置。这带来了我提交的另一个问题:"Android Studio C++ Debugger startup silently ignores phone LLDB setup critical issues"

  • 对我有用的解决方法是在设置之前创建(错误?)目标文件夹:
    adb shell
    mkdir -p /data/data/com.my.package/lldb/bin

    问题报告为 Android Studio C++ Debugger uses wrong paths on phone in LLDB setup procedure causing: failed to get reply to handshake packet

    关于android-studio-3.0 - C/C++ 调试器在 Android Studio 3.0.1 上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49148823/

    37 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com