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

Very confusing for how to use it #78

Closed clifflinmao closed 4 years ago

clifflinmao commented 4 years ago

From a user's PoV, the user guide is very confusion, e.g. if I launch the Android app on mobile device, is it possible to show available devices(when connected through USB), if not, how do I confugure VSCode for debugging? How do I know the Android player processs? ...

adelphes commented 4 years ago

Hi @clifflinmao - I'm sorry to hear you're finding the debugger confusing to use.

The debugger is set up in a similar way to other debuggers in VSCode - using launch.json and a set of custom properties used to configure the debugger.

The debugger is designed to work with the most common case - a developer connecting a single device (or emulator) and launching the app via the VSCode Start Debug command. The extension deploys the app to the device and launches it with the debugger connected. In the case that multiple devices are connected, an error is shown in the console which describes how to configure the debugger to launch on a particular device. You can also use the property-completion command in launch.json to show the list of valid properties and how they work:

image

How do I know the Android player processs

I'm not sure what you mean by this. There's currently no option in the debugger to show a list of running android processes or connect to an already-running app. You could use logcat or adb to show the IDs of running processes.

If you would like to improve the extension or documentation, I'm happy to accept PRs.

clifflinmao commented 4 years ago

Hi,

Thanks for your reply. My problem is not about debugging on multiple devices. It's about debugging a Unity 'exported' android project with VSCode, which is a bit different from debugging normal Android project with VSCode.

I understand that I need to add configuration in launch.json and I did as below. It can install and launch the APK in my phone successfully, but it does not stop at the breakpoint. I guess that is because my Android proejct is 'exported' from Unity, which has only 1 java file(which is the main activity), all my project code(that I need to debug) are not visible as Java file. So in this case, is it possible to debug with VSCode? Any example? Thanks.

image

adelphes commented 4 years ago

No, it's not possible to debug other frameworks using this debugger.

The debugger only recognises java and kotlin files and uses the builtin Java Debug Wire Protocol to configure breakpoints, stepping etc for the Java runtime. If your project uses other types of files or a different runtime (e.g native code or a JS engine), it is unlikely to work.