I've just setup a dev environment for an existing android app. Everything appears to be setup correctly, I can build the app, add breakpoints and debug the app. But i've noticed some odd behavior and i can't seem to find anything related to the problem.
It seems like this might have something to do with the activity thread finishing and probably a Android Studio debug option? I'm not really sure though, i'm still new to android development.
Why would the debugger be stopping like this? Is there a way to ensure you run to the next breakpoint?
I can also reproduce this with a new android project my adding a breakpoint into the OnCreate method and stepping through to he end like this
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); <------- Breakpoint added here setContentView(R.layout.activity_main); ...... NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); } <------- Application terminates after this line
Press Ctrl + Alt + F5 (or Shift + F9 ) to launch the app in debug mode. Choose Run -> Attach to process and select the signature of an app to enable the debug mode, which is already installed via adb.
It seems like this is a bug See issue tracker link
Using continue instead of step over at the end of methods should resolve the issue as mentioned above. Although you might need to add extra logging and put break points anywhere you expect the code to go after that method to make debugging later methods easier.
Dont use step-over when you reach the end of funciton,just use "resume program",then it will goto the next breakpoint.
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