Reputation: 593
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
Upvotes: 40
Views: 5551
Reputation: 1769
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.
Upvotes: 9
Reputation: 59
You can try a better android device which could withstand the load of debugging without crashing the application. It has happened with me, now I am using Nexus 5x which is best for development purpose.
Upvotes: -2
Reputation: 595
Dont use step-over when you reach the end of funciton,just use "resume program",then it will goto the next breakpoint.
Upvotes: 7