Android Studio:调试器未连接到进程

Android Studio:调试器未连接到进程

Android Studio 在调试时会安装并启动应用,但应用会停留在“正在等待调试器”状态,而 Android Studio 永远不会连接到应用。这种情况在无线和有线连接(USB/WiFi)上都会发生,但只发生在此设备上。

我正在运行 Windows 10,尝试在 Prestigio X Pro 上通过 Android Studio 调试应用程序(应用程序是为公司内部使用而开发的,这些是将运行该应用程序的手机)。大多数时候,我必须从 Studio 调试 5-10 次才能真正度过等待阶段,因为它无法连接。它工作的时间似乎是随机的,但经过几分钟的尝试,它最终会通过。

当尝试调试时,我从 Android Studio 获得如下输出:

09/25 12:45:07: Launching 'app' on Prestigio PSP7546DUO.
$ adb shell am start -n "com.my.app.debug/com.my.app.ui.LoginActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Waiting for application to come online: com.my.app.debug.test | com.my.app.debug
Waiting for application to come online: com.my.app.debug.test | com.my.app.debug

//The "waiting for application" continues for around 15 seconds

Waiting for application to come online: com.my.app.debug.test | com.my.app.debug
Could not connect to remote process. Aborting debug session.

我还注意到,在 Android Studio 的事件日志中,它给出了以下内容:

12:43   Executing tasks: [:app:assembleDebug] in project D:\Sources\MyAndroidApp
12:44   Gradle build finished in 10 s 385 ms
12:44   Install successfully finished in 11 s 803 ms.
12:44   Received pid (13328) does not match client pid (808530995)
12:44   Executing tasks: [:app:assembleDebug] in project D:\Sources\MyAndroidApp
12:44   Gradle build finished in 3 s 400 ms
12:44   Install successfully finished in 1 s 702 ms.: App restart successful without requiring a re-install.
12:44   Received pid (13406) does not match client pid (1697985587)
12:45   Executing tasks: [:app:assembleDebug] in project D:\Sources\MyAndroidApp
12:45   Gradle build finished in 3 s 380 ms
12:45   Install successfully finished in 1 s 391 ms.: App restart successful without requiring a re-install.
12:45   Received pid (13481) does not match client pid (962671667)

我期望的是,我会开始调试,一两秒后它会上线并继续运行应用程序。发生这种情况时,控制台输出如下:

09/25 12:48:53: Launching 'app' on Prestigio PSP7546DUO.
$ adb shell am start -n "com.my.app.debug/com.my.app.ui.LoginActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Waiting for application to come online: com.my.app.debug.test | com.my.app.debug
Waiting for application to come online: com.my.app.debug.test | com.my.app.debug
Waiting for application to come online: com.my.app.debug.test | com.my.app.debug
Connecting to com.my.app.debug
Connected to the target VM, address: 'localhost:8601', transport: 'socket'

这并没有发生,我也不太清楚为什么。如能得到任何帮助我将不胜感激。

相关内容