Skip to content

Commit

Permalink
Added proguard rules
Browse files Browse the repository at this point in the history
  • Loading branch information
jaindiv26 committed Sep 9, 2019
1 parent 7cfc2ee commit d54740f
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Expand Up @@ -9,8 +9,8 @@ android {
defaultConfig {
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
versionCode 39
versionName "1.0"
versionCode 40
versionName "1.0.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
115 changes: 114 additions & 1 deletion app/proguard-rules.pro
@@ -1,6 +1,5 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /home/tuska/Android/Sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
Expand All @@ -15,6 +14,120 @@
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

#dont generate complex names
-dontusemixedcaseclassnames

#dont skip non public classes
-dontskipnonpubliclibraryclasses

#dont verify during compilation as after java6 they are already verified,to reduce process time remove it
-dontpreverify

#Describe more info during processing,for eg,if exception occur,full stack trace will be printed.
-verbose

#optimization criteria set
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

#all files removed by default,if they are not mentioned in keep,to avoid that using this tag
-dontshrink

#dont optimize the code
-dontoptimize

-keepattributes EnclosingMethod

#to avoid obfuscation of code
#-dontobfuscate

#upgrade version of class files
#-target 1.6
#-ignorewarnings

#For crashlytics
-keepattributes *Annotation*
-keepattributes SourceFile,LineNumberTable
-keep public class * extends java.lang.Exception
-keepattributes Signature
-keepattributes Exceptions

-ignorewarnings

-keep class * {
public private *;
}

#Keep classes that are referenced on the AndroidManifest
-keep public class * extends android.app.Activity
-keep public class * extends androidx.appcompat.app.AppCompatActivity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class com.android.vending.licensing.ILicensingService
-keep public class * extends android.app.Application

-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
long producerIndex;
long consumerIndex;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
rx.internal.util.atomic.LinkedQueueNode producerNode;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef {
rx.internal.util.atomic.LinkedQueueNode consumerNode;
}


#avoid changing name of methods on layout onclick
-keepclassmembers class * {
public void onClickButton(android.view.View);
}

#avoid native methods(if any)
-keepclasseswithmembernames class * {
native <methods>;
}

#To maintain custom components names that are used on layouts XML
-keep public class custom.components.package.and.name.**

#To maintain custom components names that are used on layouts XML
-keep public class * extends android.view.View {
public <init>(android.content.Context);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
public void set*(...);
}

-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}

#To keep parcelable classes (to serialize - deserialize objects to sent through Intents)
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}

#keep R file
-keepclassmembers class **.R$* {
public static <fields>;
}

-keepattributes InnerClasses
-dontoptimize
-dontwarn InnerClasses

-keep class com.google.oauth-client.** { *; }
-keep class com.google.http-client.** { *; }
-ignorewarnings

0 comments on commit d54740f

Please sign in to comment.