更新 所谓的重复是一个在执行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。


当前回答

大多数情况下,这是由于模拟器上的资源和线程过载造成的。甚至对于GC无法释放的对象的锁:http://developer.android.com/intl/pt-br/tools/debugging/index.html

通常,一次重新启动它就可以解决问题,但有时它要求重新启动IDE,所以一定要进行两个测试。

另一个好的测试是尝试以“启动模式”启动应用程序,然后再次尝试调试模式……

注:不要忘记在每次测试之后在IDE中杀死每个调试进程。这将防止你的env过载。

其他回答

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

选项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为我解决了这个问题。

我也有同样的问题。重新启动我的android设备并关闭adb.exe进程。这样我就能解决问题了

当设备显示此消息时,执行Run->Attach debbuger,然后选择一个debbuger。它会启动activity。

确保您的活动构建变体是调试的。

如果你也想让你的版本变体APK可调试,那么在应用级构建中做一个简单的改变。gradle -

buildTypes {
        release {
            debuggable true
            /*Your rest code*/
        }
    }