Is there any way to configure Android Studio to attach the debugger to an android process automatically (specifically for a background process started by a service)? I want to have breakpoints stop execution in Android Studio for services that are running in a background process. I have been able to manually start a started service and attach the debugger manually to get this to work. I was just wondering if there is someway to configure Android Studio to do this automatically.
Edit: I probably should have mentioned first that I wanted to attach the debugger to a background android process created from starting or binding to a service.
If it is stuck waiting for a debugger means it is not attached to the app. You have to manually attach by clicking on Attach Debugger to Android process. It is on the right side of the run icon.
However, there are some situations where you must debug the application in a different way — by attaching to its process. < i>Attaching</i><i> to the process</i> means telling the CPU to send the instructions in the executable code to a debugger before they're executed by the CPU.
Move your production google-services. json file into the release folder. Then copy your debug one into the app folder (this is where the console instructs you to put it). From now on, the release build will always use the google-services.
If you have the package name, you type adb shell am set-debug-app -w packagename
to let it wait until debugger connected.
You can run an app with a debugger directly attachted to it at startup by using this little button:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With