Search code examples
androidproguard

Identifying errors in Release build of Android application


I've recently started studying the build flavors of the Android application and the Proguard. So what I'm doing now is creating a release build of my application. For this, following are the changes I've made in buildTypes of my build.gradle file.

buildTypes {
    debug {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt')
    }
    release {
        minifyEnabled true
        zipAlignEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.chitchatReleaseConfig
    }
}

I've created a proguard-rules.pro file for the release build by referring the following link as mentioned at various places.

https://www.guardsquare.com/en/proguard/manual/examples

However, I'm still confused as to what types of files in my project apart from the general files I should actually include in the proguard-rules.pro. Because obviously due to the release build, at certain points in my app, I keep getting the FileNotFoundException and I'm not able to debug it.

So how do I decide what files in my project I should include in my proguard-rules.pro and how do I debug FileNotFoundException in my app in the release build?


Solution

  • Proguard comes with certain problems but it works great for minifying the apk size and code obfuscation. I will suggest that if you are using third party libraries in your app then use their proguard-rules as well in proguard-rules file.

    To get error from signed apk use Firebase Crashlytic. Its easy to integrate(10 minute max) and it will show the complete stacktrace of exception on your firebase console .