I’ve written some code in Java, which I’ve compiled into an AAR from Android Studio, that I need to use in my Xamarin.Android app. I’ve done this by following the instructions here to create a bindings library for my Java code.
Now I would like to step into the Java code to investigate an issue. Is it possible to do this from either Visual Studio or Android Studio? Thanks.
edit: For example, would it be possible to somehow attach the Android Studio debugger to my app’s process? It calls the code in the AAR, but I’m not sure if Android Studio would know where to look for the AAR’s sources in order to debug.
Pleasantly, the answer is yes and it couldn’t be simpler to do so. After you start debugging from Visual Studio, go to your Android Studio project and click this button:
A dialog will come up asking which process you want to attach to. Make sure you have ‘Show all processes’ checked, and you will be able to see one corresponding to your app.
Once you attach to your app’s process, you will be able to set breakpoints in the Java code and have them work like magic.