Android Studio's debugger not stopping at breakpoints within library modules

As stated in the comments of this issue, setting minifyEnabled false in the debug build is the best practice. By setting this variable in the app module you are disabling the entire proguard build process. It is useful when optimizing the release build, but gives some problems if you are testing and developing.


I kind of solved it, although I don't fully understand it yet. The problem was that ProGuard still was active like @Feantury suggested. I don't know why that was the case as I had specified minifyEnabled false in every build.gradle position I could imagine, but it seems it didn't have any effect.

As I had a crash just a few minutes ago, I saw lines in the stacktrace that looked like so:

java.lang.NullPointerException
        at com.example.MyClass(Unknown Source)
        ...

That made ProGuard the number one suspect for me. After some searching around, I found another SO question that deals with the Unknown Source problem. I tried the suggested solution for debugging with ProGuard enabled and voilà it worked!

Simply add the following lines to proguard-rules.txt:

-renamesourcefileattribute SourceFile    
-keepattributes SourceFile,LineNumberTable

in addition to olik79's answer, I would like to add that , these two lines will make your app hit to breakpoints in fragments. otherwise it may baypass fragments

-keep public class * extends android.support.v4.** {*;}
-keep public class * extends android.app.Fragment

here is my complete edit on proguard-android.txt in sdk\tools\proguard

# The support library contains references to newer platform versions.
# Don't warn about those in case this app is linking against an older
# platform version.  We know about them, and they are safe.
-dontwarn android.support.**

-keep class !android.support.v7.internal.view.menu.**,android.support.** {*;}
-ignorewarnings
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable

-keep public class * extends android.support.v4.** {*;}
-keep public class * extends android.app.Fragment