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'

這並沒有發生,我也不完全確定為什麼。任何幫助,將不勝感激。

相關內容