最終更新:2017-04-27 (木) 16:01:58 (909d)  

ProGuard はてなブックマークを見る
Top / ProGuard

ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier.

http://proguard.sourceforge.net/

概要

  • ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier. It detects and removes unused classes, fields, methods, and attributes. It optimizes bytecode and removes unused instructions. It renames the remaining classes, fields, and methods using short meaningless names. Finally, it preverifies the processed code for Java 6 or higher, or for Java Micro Edition.

ドキュメント

使い方

build.gradle

proguard-rules.pro

proguard-rules.txt

デフォルトの設定

  • sdk\tools\proguard

proguard-android.txt

  • # Optimization is turned off by default. Dex does not like code run
    # through the ProGuard optimize and preverify steps (and performs some
    # of these optimizations on its own).
    -dontoptimize
    -dontpreverify
    # Note that if you want to enable optimization, you cannot just
    # include optimization flags in your own project configuration file;
    # instead you will need to point to the
    # "proguard-android-optimize.txt" file instead of this one from your
    # project.properties file.

proguard-android-optimize.txt

  • # Optimizations: If you don't want to optimize, use the
    # proguard-android.txt configuration file instead of this one, which
    # turns off the optimization flags.  Adding optimization introduces
    # certain risks, since for example not all optimizations performed by
    # ProGuard works on all versions of Dalvik.  The following flags turn
    # off various optimizations known to have issues, but the list may not
    # be complete or up to date. (The "arithmetic" optimization can be
    # used if you are only targeting Android 2.0 or later.)  Make sure you
    # test thoroughly if you go this route.
    -optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
    -optimizationpasses 5
    -allowaccessmodification
    -dontpreverify
    
    # The remainder of this file is identical to the non-optimized version
    # of the Proguard configuration file (except that the other file has
    # flags to turn off optimization).

機能

代替

関連