更新 所谓的重复是一个在执行Run时陷入“等待调试器”的问题,而这个问题是在执行调试时陷入“等待调试器”,产生问题的步骤是不同的,解决方案也是不同的。


每当我尝试使用Android Studio的调试功能,运行状态总是卡在:

Launching application: com.astrotek.parashoot.debug/com.astrotek.ptpviewer.StarterActivity.
DEVICE SHELL COMMAND: am start -n "com.astrotek.parashoot.debug/com.astrotek.ptpviewer.StarterActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.astrotek.parashoot.debug/com.astrotek.ptpviewer.StarterActivity }

而我正在调试的设备(三星Galaxy S3 Android 4.3)将显示

从Android Studio 0.8.8一直到1.0都是如此。在同一台计算机上,我可以在同一台设备上使用Eclipse执行调试,而不会出现任何问题。

问题是如何让Android Studio调试工作?


更新:在运行Android 5.0的Nexus 7(2013)上调试时也会发生同样的事情;在另一台机器上进行测试得到了相同的结果。我不是唯一一个遇到这个问题的人:-/


更新:打开赏金,因为这个问题太烦人了。即使重新安装应用程序也解决不了问题。Nexus 5运行Cyano, Win7 64。亚行的日志很能说明问题:

8568-8568/it.myapp:myprocess W/ActivityThread﹕ Application it.myapp is waiting for the debugger on port 8100...
8568-8568/it.myapp:myprocess I/System.out﹕ Sending WAIT chunk

此外,我找不到一个简单的方法来断开或重置ADB连接在Android Studio。


当前回答

这种情况也时常发生在我身上。问题是你的应用程序/设备被配置为等待调试器。在这种情况下,它在继续执行之前等待调试器。

选项1:

Attach debugger or run in debug mode. You can do this in Android Studio. Buttons to attach debugger and run in debug mode are located next to normal run mode (Bug and Bug with arrow).

选项2:

Disable Wait for debugger. You can do this is developer settings. This option needs to be disabled in:

开发人员选项的根 开发人员选项->选择调试应用-> ->等待调试器

这是在Android studio的Android模拟器上测试的。其他手机可能有不同的设置。如果你在调试中找不到app的设置,重新安装app也可以。

其他回答

尝试了这里给出的所有解决方案,但重新启动我的笔记本电脑对我有效。

这似乎是Android Studio的另一个bug。 为了防止这个问题,返回到Android Studio v4.1.3(4.1.1)或更早的版本,并使用Android Gradle Plugin Version 4.1+和Gradle Version 6.6。在此之后,android studio工作正常。如果这个答案有用,就说谢谢。

我的两台开发机器都安装了JDK 8,一旦安装了JDK 7.0.71,并且JAVA_HOME环境变量被设置为指向新的JDK,调试功能就会恢复。

我猜Android Studio + ADB + JDK8之间存在一些兼容性问题(Eclipse + ADB + JDK8工作正常)。

这为我解决了问题。Android Studio ->文件->无效缓存和重启…

有时这是因为在构建过程中。Gradle配置你必须设置节点:

  debug {
            debuggable true
        }

当你必须准备签名的apk时,把它改回false。

问候