Reputation: 268
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?
Upvotes: 0
Views: 1225
Reputation: 21053
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 .
Upvotes: 3
Reputation: 389
Fabric Crashlytic will be best. I am using it and able to track crashes in the release build version wise.
Upvotes: 0
Reputation: 1153
Try this:
android {
signingConfigs {
SignNAME {
keyAlias 'yourKeyAliasName'
keyPassword 'yourKeyAliasPassword'
storeFile file('F:/ANDROID KEYSTORES/myKeystore.jks') // Give the Path of your Keystore here
storePassword 'yourStorePassword'
}
}
compileSdkVersion 24 // change depending upon your requirement
buildToolsVersion "24.0.3" // change depending upon your requirement
defaultConfig {
applicationId "com.yourPackageName.yourAppName"
minSdkVersion 18 // change depending upon your requirement
targetSdkVersion 24 // change depending upon your requirement
versionCode 1 // change depending upon your requirement
versionName "1.0" // change depending upon your requirement
multiDexEnabled true
signingConfig signingConfigs.SignNAME
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
After this, in Android Studio above Bottom-Left Corner you will find Build Variants
. Click it and change Build Variants
from debug
to release
. Wait until gradle builds. And you are all set to Run
.
Upvotes: 0