Android Studio Project Setup and Configuration

I’m trying to address a bug Retroarch on Android ( where bluetooth controllers, after disconnect, reconnect to the wrong port. I’m pretty sure I can fix this, but I can’t figure out how to get a debugger working or to produce log output. This makes development difficult in an unfamiliar system.

I’m able to build the project and deploy the APK onto my tablet by following the instructions here:

I have to believe that there are developers out there with a working development environment. I can’t imagine that I’m alone in wishing that I could contribute to this project, but lacking the tools and documentation to make that happen. If you’re one of those developers, and you can help me get my env setup, I’d be more than happy to contribute back to the official documentation to solve this problem going forward.

Help me Obi Wan Kenobi... you're my only hope...

I think most people use adb/gdb:

Awesome. Thank you. I’ll check it out.

This appears to be an updated version of the above documentation.

Also, this might be helpful:

Though it seems focused on debugging a core, it may be possible to use the instructions here for debugging one of the underlying libs. I’m going to take a stab at this. I figure that Android Studio debugging SHOULD be a path here. I’d love to work to update the build system to “just work” in Android Studio.

1 Like

OMG!!! THIS TOTALLY WORKED!!! I wrote up some info on it in GitHub:

1 Like

@hunterk I’ve been trying to work this through and could use some help. You seem to be somebody in the know, so I’ll ask you directly.

I added code to just raise an exception in input/drivers_hid/btstack_hid.c. When I recompile and deploy to my tablet, and then poke what I think is the code (by attaching a bluetooth controller) nothing happens.

I’ve tried a number of different things but I can’t seem to figure out how this code is getting included, how to build it properly, and for that matter how to debug it. Can you help by providing any kind of understanding here?

I did grep the project tree for a reference to btstack_hid.c and I found that it’s only included in the griffin.c file. I found you discussing griffin in another post.

Should I run a debugger against the griffin source code and attach to a running process on my tablet? I’m kind of lost in the woods here. C++ and Android are not my native systems, so this is all a bit foreign to me. I’d be grateful for a pointer towards docs or anything that’s a bit more specific to this project. Given my newness it’s a bit hard to start at the Android docs and learn all the things I need to know to do a few “simple” things here.

I really want to fix this long standing bug. I’m sure there’s a way to do it, even if it’s a bit of a hack.

I believe btstack is only used on iOS.

1 Like

That explains a lot.