Skip to content
This repository was archived by the owner on Nov 20, 2019. It is now read-only.

Trying to merge all ProGuard forks. #5 #161

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@ Request additional libraries through issues. Pull requests are welcome.
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-android--proguard--snippets-brightgreen.svg?style=flat)](https://android-arsenal.com/details/3/1242)

### Usage

#### 1. Include the proguard files in your project
First of all, add the repository as a git submodule (or just copy the proguard files in your project).

#### 2. Integrate the proguard files in your project
```groovy
android {
buildTypes {
release {
minifyEnabled true
// Library specific proguard files
proguardFile 'proguard-google-play-services.pro'
proguardFile 'proguard-gson.pro'
proguardFile '$PATH_TO_THE_PROGUARD_FILES/proguard-google-play-services.pro'
proguardFile '$PATH_TO_THE_PROGUARD_FILES/proguard-gson.pro'
...
// Default proguard files & project app specific rules,
// see examples folder for more information
Expand All @@ -32,8 +37,7 @@ android {

Instead of declaring each configuration file manually, you could also store them in a seperate directory and include them all at once:
```groovy
FileCollection proGuardFileCollection = files { file('./proguard').listFiles() }
proguardFiles(proGuardFileCollection)
proguardFiles fileTree(dir: "$PATH_TO_THE_PROGUARD_FILES", include: ["*.pro"]).asList().toArray()
```

### Libraries
Expand Down
10 changes: 10 additions & 0 deletions libraries/proguard-butterknife-8.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ButterKnife 8

# Retain generated class which implement Unbinder.
-keep public class * implements butterknife.Unbinder { public <init>(...); }

# Prevent obfuscation of types which use ButterKnife annotations since the simple name
# is used to reflectively look up the generated ViewBinding.
-keep class butterknife.*
-keepclasseswithmembernames class * { @butterknife.* <methods>; }
-keepclasseswithmembernames class * { @butterknife.* <fields>; }
13 changes: 13 additions & 0 deletions libraries/proguard-dart.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Dart 2.x
# https://github.com/f2prateek/dart#proguard

-dontwarn com.f2prateek.dart.internal.**
-keep class **$$ExtraInjector { *; }
-keepclasseswithmembernames class * {
@com.f2prateek.dart.* <fields>;
}

#for dart 2.0 only
-keep class **Henson { *; }
-keep class **$$IntentBuilder { *; }

8 changes: 8 additions & 0 deletions libraries/proguard-dbflow-4.0.5.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Proguard Configuration for Dbflow 4.0.5

-keepattributes Annotation

-keep class * extends com.raizlabs.android.dbflow.config.DatabaseHolder { *; }

-keep class net.sqlcipher.** { *; }
-dontwarn net.sqlcipher.
18 changes: 13 additions & 5 deletions libraries/proguard-gson.pro
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
## GSON 2.2.4 specific rules ##

##---------------Begin: proguard configuration for Gson ----------
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature

# For using GSON @Expose annotation
-keepattributes *Annotation*

-keepattributes EnclosingMethod

# Gson specific classes
-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.stream.** { *; }
#-keep class com.google.gson.stream.** { *; }

# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { *; }

# Prevent proguard from stripping interface information from TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

##---------------End: proguard configuration for Gson ----------
25 changes: 25 additions & 0 deletions libraries/proguard-itext.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Proguard Configuration for iText 5.5.11

-keep class org.spongycastle.** { *; }
-dontwarn org.spongycastle.**

-keep class com.itextpdf.** { *; }

-keep class javax.xml.crypto.dsig.** { *; }
-dontwarn javax.xml.crypto.dsig.**

-keep class org.apache.jcp.xml.dsig.internal.dom.** { *; }
-dontwarn org.apache.jcp.xml.dsig.internal.dom.**

-keep class javax.xml.crypto.dom.** { *; }
-dontwarn javax.xml.crypto.dom.**

-keep class org.apache.xml.security.utils.** { *; }
-dontwarn org.apache.xml.security.utils.**

-keep class javax.xml.crypto.XMLStructure
-dontwarn javax.xml.crypto.XMLStructure

-keep interface com.itextpdf.**

-dontwarn com.itextpdf.**
3 changes: 3 additions & 0 deletions libraries/proguard-opencsv.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Proguard configuration for openCSV

-dontwarn org.apache.commons.beanutils.**
13 changes: 9 additions & 4 deletions libraries/proguard-parceler.pro
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# Parceler rules
# Source: https://github.com/johncarl81/parceler#configuring-proguard

-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}

-keep interface org.parceler.Parcel
-keep @org.parceler.Parcel class * { *; }
-keep class **$$Parcelable { *; }
-keep class org.parceler.Parceler$$Parcels

-dontwarn org.parceler.apache.commons.**
-dontwarn org.parceler.ParcelAnnotationProcessor
-dontwarn org.parceler.transfuse.bootstrap.BootstrapProcessor
-dontwarn org.parceler.codemodel.util.SingleByteEncoder
-dontwarn java.beans.**
12 changes: 10 additions & 2 deletions libraries/proguard-rx-java.pro
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# RxJava 0.21

# RxJava 1.2.4

-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
long producerIndex;
long consumerIndex;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
long producerNode;
long consumerNode;
}
-keep class rx.schedulers.Schedulers {
public static <methods>;
}
Expand Down
7 changes: 2 additions & 5 deletions libraries/proguard-square-okhttp3.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# OkHttp
-keepattributes Signature
-keepattributes *Annotation*
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**
-dontwarn okhttp3.**
-dontwarn javax.annotation.*
5 changes: 1 addition & 4 deletions libraries/proguard-square-okio.pro
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
# Okio
-keep class sun.misc.Unsafe { *; }
-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn okio.**
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
14 changes: 6 additions & 8 deletions libraries/proguard-square-retrofit2.pro
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# Retrofit 2.X
## https://square.github.io/retrofit/ ##

-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepattributes Signature
-keepattributes Exceptions

-keepclasseswithmembers class * {
@retrofit2.http.* <methods>;
}
# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnote retrofit2.Platform
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarn retrofit2.Platform$Java8
# Retain generic signatures used for parsing the return types reflectively.
-keepattributes Signature
4 changes: 4 additions & 0 deletions libraries/proguard-viewpagerindicator.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#View Pager Indicator
# https://github.com/JakeWharton/ViewPagerIndicator/issues/366#issuecomment-159972837

-dontwarn com.viewpagerindicator.LinePageIndicator