Jcorretjer
Jcorretjer

Reputation: 507

How to debug an activity started with an Intent?

In the project that I'm working on, we have several other modules imported in. Just so you all can visualize it better, let's say I have M1(Module 1) and M2(Module 2). M1 starts M2 with startActivity(m2Intent). I've got several breakpoints in M1 and several others in M2. If I debug both modules in isolation, the active breakpoints are hit. Nothing out of the ordinary there. If I debug them together(meaning that the intent for M2 is started by M1) the breakpoints for M2 never hit.

One thing that's worth noting, any log printed by M2 is visible in the logcat even if the breakpoints don't work.

Upvotes: 1

Views: 1070

Answers (1)

Jcorretjer
Jcorretjer

Reputation: 507

I figured it out. Every time I need to debug M1 and M2 together I have to do the following:

  1. On the 1st breakpoint hit of M1, I go into run>attach debugger to android process
  2. Make sure the debugger settings and debug type are set and selected to M2.
  3. Now breakpoints for M2 hit.

Upvotes: 1

Related Questions