How to debug android library module in Android Studio?

后端 未结 4 1889
离开以前
离开以前 2021-02-08 03:48

I have an Android Studio project which contains a library module, which is added as another gradle project to it. I would like to debug the library code and set breakpoints on i

4条回答
  •  不要未来只要你来
    2021-02-08 04:23

    I faced this issue long time ago. some gradle versions will switch your library to release mode even if you set it to debug. the fix is either update gradle to latest. if it didnt fix it. inside your library, don't use:

    if BuildConfig.DEBUG
    

    instead use :

    boolean isDebuggable = ( 0 != ( getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE ) );
    

提交回复
热议问题