From 010f44bbe64306a7376f9829fcd434e56b078ac4 Mon Sep 17 00:00:00 2001 From: Luciano Balmaceda Date: Thu, 29 Dec 2016 18:37:15 -0300 Subject: [PATCH] update proguard rules and include them on the packaging --- README.md | 2 +- app/build.gradle | 4 ---- lib/build.gradle | 7 +------ proguard/proguard-gson.pro | 4 +++- proguard/proguard-lock-2.pro | 8 +++++++- proguard/proguard-okio.pro | 6 ------ proguard/proguard-otto.pro | 1 - 7 files changed, 12 insertions(+), 20 deletions(-) delete mode 100644 proguard/proguard-okio.pro diff --git a/README.md b/README.md index f953d61bc..b7ab763a6 100644 --- a/README.md +++ b/README.md @@ -202,7 +202,7 @@ startActivity(lock.newIntent(this)); ``` ##Proguard -In the [proguard directory](proguard) you can find the *Proguard* configuration for Lock and its dependencies. +The rules should be applied automatically if your application is using `minifyEnabled = true`. If you want to include them manually check the [proguard directory](proguard). By default you should at least use the following files: * `proguard-okio.pro` * `proguard-gson.pro` diff --git a/app/build.gradle b/app/build.gradle index 7a502b025..9d19ce41d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -27,10 +27,6 @@ android { } release { minifyEnabled true - proguardFile '../proguard/proguard-lock-2.pro' - proguardFile '../proguard/proguard-okio.pro' - proguardFile '../proguard/proguard-otto.pro' - proguardFile '../proguard/proguard-gson.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.release } diff --git a/lib/build.gradle b/lib/build.gradle index bf0754d5b..8bbacfafa 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -14,12 +14,7 @@ android { targetSdkVersion 24 versionCode 1 versionName semver.stringVersion - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } + consumerProguardFiles '../proguard/proguard-gson.pro', '../proguard/proguard-otto.pro', '../proguard/proguard-lock-2.pro' } } diff --git a/proguard/proguard-gson.pro b/proguard/proguard-gson.pro index b5e9f7e34..9c0d93929 100644 --- a/proguard/proguard-gson.pro +++ b/proguard/proguard-gson.pro @@ -1,4 +1,6 @@ # Gson -keepattributes Signature --keepattributes *Annotation* \ No newline at end of file +-keepattributes *Annotation* + +-dontwarn com.google.gson.internal.UnsafeAllocator \ No newline at end of file diff --git a/proguard/proguard-lock-2.pro b/proguard/proguard-lock-2.pro index c8760c0f3..85fd5e1ea 100644 --- a/proguard/proguard-lock-2.pro +++ b/proguard/proguard-lock-2.pro @@ -3,4 +3,10 @@ ## Parcelables -keepnames class * implements android.os.Parcelable { public static final ** CREATOR; -} \ No newline at end of file +} + +## Descriptor classes +-keep public class com.auth0.android.lock.events.* +-keep public class com.auth0.android.lock.adapters.Country +-keep public interface com.auth0.android.lock.internal.configuration.OAuthConnection +-keep public interface com.auth0.android.lock.views.interfaces.IdentityListener \ No newline at end of file diff --git a/proguard/proguard-okio.pro b/proguard/proguard-okio.pro deleted file mode 100644 index 11d9e1558..000000000 --- a/proguard/proguard-okio.pro +++ /dev/null @@ -1,6 +0,0 @@ -# Okio - --keep class sun.misc.Unsafe { *; } --dontwarn java.nio.file.* --dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement --dontwarn okio.** diff --git a/proguard/proguard-otto.pro b/proguard/proguard-otto.pro index 467111e7c..86233f780 100644 --- a/proguard/proguard-otto.pro +++ b/proguard/proguard-otto.pro @@ -3,5 +3,4 @@ -keepattributes *Annotation* -keepclassmembers class ** { @com.squareup.otto.Subscribe public *; - @com.squareup.otto.Produce public *; } \ No newline at end of file