Example Proguard configurations for common Android libraries.
This project assumes that your ProGuard configuration is based off of the latest official proguard-android.txt config as shown below. Each library configuration should only be the rules required for that specific library, not a complete Android ProGuard configuration. The various library configurations are combined by the Gradle build system. The library rules should be universal, any app specific rules (such as preserving model classes) should be added in a custom proguard-project.pro
file.
Request additional libraries through issues. Pull requests are welcome.
android {
buildTypes {
release {
minifyEnabled true
// Library specific proguard files
proguardFile 'proguard-google-play-services.pro'
proguardFile 'proguard-gson.pro'
...
// Default proguard files & project app specific rules,
// see examples folder for more information
proguardFile 'proguard-project-app.pro'
proguardFile getDefaultProguardFile('proguard-android.txt')
// As of Gradle Android plugin 1.1.0, the test APK has a separate config
testProguardFile 'proguard-project-test.pro'
}
}
}
- ACRA 4.5.0
- ActionBarSherlock 4.4.0
- ActiveAndroid
- Amazon Web Services 1.6.x / 1.7.x
- Amazon Web Services 2.1.x
- AndroidAnnotations
- android-gif-drawable
- Apache Avro
- Butterknife 5.1.2
- Crashlytics 1.+
- Crittercism
- EventBus 2.0.2
- Facebook 3.2.0
- Facebook Conceal
- Facebook Stetho
- Flurry 3.4.0
- Google Analytics 3.0+
- Google Guava
- Google Play Services 4.3.23
- GreenDao 1.3.x
- GSON 2.2.4
- Jackson 2.x
- Joda-Convert 1.6
- Joda-Time 2.3
- New Relic
- Parse
- Realm
- RxJava 0.21
- RxJava-Promises
- Support Library v7
- Sqlite
- Square OkHttp
- Square Okio
- Square Otto
- Square Picasso
- Square Retrofit
- Square Wire
- Icepick
- [Simple-Xml] (http://simple.sourceforge.net/)
The android libraries developers can include the proguard directives in the libraries. The Android Plugin for Gradle automatically appends ProGuard configuration files in an AAR (Android ARchive) package and appends that package to your ProGuard configuration
The developers only need to specify the Proguard file with consumerProguardFiles
instead of proguardFiles
:
defaultConfig {
consumerProguardFiles 'proguard-file.txt'
}