adelphes / android-dev-ext

Android debugging support for VS Code
https://marketplace.visualstudio.com/items?itemName=adelphes.android-dev-ext
MIT License
212 stars 29 forks source link

Fail to attach debugger #114

Closed yydmay closed 3 years ago

yydmay commented 3 years ago

Hi there,

I am fairly new to Android in VSCode, trying to debug my android app in VSCode, I followed instruction to setup launch file but got this message when press the debug button

Attaching to pid 9843 on device (mydevice id here) [API:26] Attach failed: A debugger connection to pid 9843 could not be established. JDWP socket read failed. Socket closed. Ensure any instances of Android Studio are closed and ADB is running.

I've google'd bit but wasn't able to find any solutions. any one has a clue?

yydmay commented 3 years ago

forgot to attach launch config, its auto generated one, didn't make changes, VScode version is 1.55.2 { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "type": "android", "request": "launch", "name": "Android launch", "appSrcRoot": "${workspaceRoot}\src\main", "apkFile": "${workspaceRoot}\build\outputs\apk\debug\app-debug.apk", "adbPort": 5037 }, { "type": "android", "request": "attach", "name": "Android attach", "appSrcRoot": "${workspaceRoot}\src\main", "adbSocket": "localhost:5037", "processId": "${command:PickAndroidProcess}" } ] }

adelphes commented 3 years ago

Hi @yydmay - just to confirm that you read the error message:

What OS are you using?

yydmay commented 3 years ago

Hi @adelphes

Closed my AS and tried again, and everything is working as expected. Now I can get rid of this resource hog. Thanks for your help.