Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

Proguard

lyricallogical edited this page Mar 20, 2012 · 3 revisions

ProGuard

Config

You can add additional config parameters with the setting proguardOption:

  settings = ... ++ Seq(
    proguardOption in Android := "-keep class com.foo.Bar"
  )

Optimisation

The plugin allows to run ProGuard optimizations on your classes. This might improve the performance of your application dramatically, but also break it easily. By default, ProGuard shrinks and optimizes the application. To skip optimization, add the -dontoptimize flag to the proGuardOptimizations val.

If you want to apply optimizations, you specify ProGuard optimization options in your project like this:

  lazy val someOptimizedProject = Project(
    id = ...,
    ...
    settings = ... ++ Seq(
        proguardOptimizations in Android := Seq(
          "-optimizationpasses 8",
          "-dontpreverify",
          "-allowaccessmodification",
          "-optimizations !code/simplification/arithmetic"
        )
    )
  )

Please note that you will receive even more warnings from ProGuard and dex when you apply optimizations.