Skip to content

Commit

Permalink
enabling progaurd.
Browse files Browse the repository at this point in the history
  • Loading branch information
pranayairan committed Jan 14, 2019
1 parent 38d6aaf commit 05b0f02
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 13 deletions.
9 changes: 5 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ android {
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
multiDexEnabled true
versionCode 1
versionCode 2
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Expand All @@ -42,8 +43,8 @@ dependencies {
androidTestImplementation "com.android.support.test:runner:${versions.testRunner}"
androidTestImplementation "com.android.support.test.espresso:espresso-core:${versions.espresso}"

debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
debugImplementation "com.squareup.leakcanary:leakcanary-android:${versions.leakcanary}"
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:${versions.leakcanary}"


implementation fileTree(dir: 'libs', include: ['*.jar'])
Expand Down
69 changes: 61 additions & 8 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,21 +1,74 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
# By default, the flags in this file are appended to flags specified
# in /Applications/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
-keepclassmembers class * implements android.os.Parcelable {
static ** CREATOR;
}

#this is for crashlytics logs which will deofubscate errors
-keepattributes *Annotation*
-keepattributes SourceFile,LineNumberTable
-keep public class * extends java.lang.Exception


## --------------- Proguard configuration for Okhttp ----------------------
# JSR 305 annotations are for embedding nullability information.
-dontwarn javax.annotation.**

# A resource is loaded with a relative path so the package of this class must be preserved.
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase

# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
-dontwarn org.codehaus.mojo.animal_sniffer.*

# OkHttp platform used only on JVM and when Conscrypt dependency is available.
-dontwarn okhttp3.internal.platform.ConscryptPlatform

## --------------- Proguard configuration for Retrofit ----------------------
# don't obfuscate data model objects because GSON needs to rebuild them using reflection
-keep class com.binarybricks.coiny.network.models.** { *; }
-keepclassmembers enum com.binarybricks.coiny.network.models.** { *; }

# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and
# EnclosingMethod is required to use InnerClasses.
-keepattributes Signature, InnerClasses, EnclosingMethod

# Retain service method parameters when optimizing.
-keepclassmembers,allowshrinking,allowobfuscation interface * {
@retrofit2.http.* <methods>;
}

# Ignore annotation used for build tooling.
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath.
-dontwarn kotlin.Unit

# Top-level functions that can only be used by Kotlin.
-dontwarn retrofit2.-KotlinExtensions

### Glide, Glide Okttp Module, Glide Transformations
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public class * extends com.bumptech.glide.module.AppGlideModule
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
**[] $VALUES;
public *;
}

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
# Gson specific classes
-keep class sun.misc.Unsafe { *; }
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ buildscript {
'bottomNav' : '1.2.4',
'firebaseCore' : '16.0.6',
'firebasePerf' : '16.2.3',
'crashlytics' : '2.9.8'
'crashlytics' : '2.9.8',
'leakcanary' : '1.6.3'
]

repositories {
Expand Down

0 comments on commit 05b0f02

Please sign in to comment.