android-proguard-snippets 0,4,0,6,2,10,0,2

Proguard configurations for common Android libraries

2 years after Apache-2.0

android-proguard-snippets

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 Arsenal

Usage

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'
    }
  }
}

Instead of declaring each configuration file manually, you could also store them in a seperate directory and include them all at once:

FileCollection proGuardFileCollection = files { file('./proguard').listFiles() }
proguardFiles(proGuardFileCollection)

Libraries

ProGuard tip for android libraries developers

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.pro'
}

Related Repositories

share

share

Android 开源交流 QQ 群分享汇总, 微信公众号:codekk, 网站: ...

cwac-cam2

cwac-cam2

Android Camera API, Made Better. Again. ...

android-proguards

android-proguards

AAR proguards ...

awesome-android-complete-reference

awesome-android-complete-reference

Awesome Android references for everything like best practices, performance optim ...

awesome-android-tools

awesome-android-tools

A curated list of awesome Android Tools. ...


Top Contributors

krschultz michaelcarrano ruijun SandroMachado groupsky creativepsyco robbypond stoyicker GregSaintJean Gregliest MichaelEvans nekofar mdakram alexantaniuk MustafaFerhan vanniktech dlackty icechen1 dlew stxNextTravis bkfrcm androidfu ChaitanyaPramod dallasgutauckis almozavr davidandreoletti gelldur flolom ignasi ipereziriarte