Using Latest Android Studio and having updated all platform ( OsX) :
Build.gradle :
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.xxxxxxlxxxxxx.apps.firebase"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Proguard-rules.pro :
-keep public class OpenSource
As you can see proguard is enabled and rules also given for just keeping OpenSource class. Still when i build its apk / signed apk. And uses following commands on apk file :
It would be very nice to have your suggestions on it. Thanks.
To enable ProGuard in Android Studio. Below is the sample how to enable default ProGuard in Android Studio.
1) Go to the build.gradle file of app
2) enable the proguard minifyEnabled true and useProguard true
3) enable shrinkResources true to reduce the APK size by shrinking resources.
4) proguardFiles getDefaultProguardFile('proguard-android.txt') to enable the default one. If you want to use your own proguard file then use the below rules.
buildTypes {
release {
debuggable false
useProguard true
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
useProguard true
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With