Giter VIP home page Giter VIP logo

android-proguard-snippets's Introduction

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

android-proguard-snippets's People

Contributors

alexantaniuk avatar almozavr avatar billmote avatar bkfrcm avatar chaitanyapramod avatar creativepsyco avatar dallasgutauckis avatar davidandreoletti avatar dlackty avatar dlew avatar flolom avatar gelldur avatar gregliest avatar gregsaintjean avatar groupsky avatar ignasi avatar ipereziriarte avatar krschultz avatar mdakram avatar michaelcarrano avatar michaelevans avatar mustafaferhan avatar nekofar avatar robbypond avatar ruijun avatar sandromachado avatar stoyicker avatar stxnexttravis avatar vanniktech avatar yucombinator avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.