4

Can you give me some tips on how to debug a massive app? (Android app running on android studio which is basically intellij idea).

For example I need to fix a bug where a certain action results in unexpected behaviour.

But oh my god the codebase is so large (mainly architecture is MVVM and rxjava) that searching for the specific place is like searching for a needle in haystack.

For example I added a breakpoint in few places, but I can see only like 4 or 5 last frames in the stack that led to the current action, last frame is a lambda which doesnt help me so frankly Im unable to even track where current event started. I am loosing my mind. I cant even find where the buttonclick action started because everything is reactive and done with observables which can be anywhere.

Any tips on debugging will be appreciated

Comments
  • 2
    tl;dr Rxjava is a biatch.
    There is no easy way to untagle the event propagation in the observed/observable stack. I would try - to method trace the fucker.
    Put a method trace start in the button handler, and a method trace stop somewhere else. then look at the trace file, and figure out what happend.
    Not going to lie - that shit is going to suck. I prefer pub/sub or eventbus becuase of this.
  • 0
    @magicMirror what is a method trace? I have no idea how to do it.
  • 0
  • 0
    @magicMirror this is like stacktrace frames in a debugging window?
  • 1
    @zemaitis not even close.
    but it you do it correctly, it will allow you to see which methods were called in the time the trace was active.
  • 0
    @magicMirror i see. Im unable to find any decent tutorial as to how to track methods stack via profiler.. all tutorials seem to be concentrating on tracking spikes in cpu/ram, not which methods were called
  • 1
    @zemaitis You can do that in code, using reflection and/or the thread object. but it will be really hard to understand, as rxjava can trigger the same methods from differnt callers. in any case, add it as a global static method, and don't print the last element. then call it anywhere you want.
    https://stackoverflow.com/a/4065546

    A method trace will help you understand which code is called in a tight time frame. Using the stacktrace - you can see who called the methods. Both will be really hard to use.
Add Comment