1<!doctype html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3<head> 4<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> 5<meta http-equiv="content-style-type" content="text/css"> 6<link rel="stylesheet" type="text/css" href="style.css"> 7<title>ProGuard Reference Card</title> 8</head> 9<body> 10 11<script type="text/javascript" language="JavaScript"> 12<!-- 13if (window.self==window.top) 14 document.write('<a class="largebutton" target="_top" href="../index.html#manual/refcard.html">ProGuard index</a> <a class="largebutton" target="_top" href="http://www.saikoa.com/dexguard">DexGuard</a> <a class="largebutton" target="_top" href="http://www.saikoa.com/">Saikoa</a> <a class="largebutton" target="other" href="http://sourceforge.net/projects/proguard/">Sourceforge</a>') 15//--> 16</script> 17<noscript> 18<a class="largebutton" target="_top" href="../index.html#manual/refcard.html">ProGuard index</a> 19<a class="largebutton" target="_top" href="http://www.saikoa.com/dexguard">DexGuard</a> 20<a class="largebutton" target="_top" href="http://www.saikoa.com/">Saikoa</a> 21<a class="largebutton" target="other" href="http://sourceforge.net/projects/proguard/">Sourceforge</a> 22</noscript> 23 24<h1>ProGuard Reference Card</h1> 25 26<h2>Usage</h2> 27 28<code><b>java -jar proguard.jar </b></code><i>options</i> ... 29<p> 30 Typically: 31<p> 32<code><b>java -jar proguard.jar @myconfig.pro</b></code> 33<p> 34 35<h2>Options</h2> 36 37<table cellspacing="10"> 38 39<tr> 40<td valign="top"><a href="usage.html#at"><code><b>@</b></code></a><a href="usage.html#filename"><i>filename</i></a></td> 41 42<td>Short for '<code>-include</code> <i>filename</i>'.</td> 43</tr> 44 45<tr> 46<td valign="top"><a href="usage.html#include"><code><b>-include</b></code></a> 47 <a href="usage.html#filename"><i>filename</i></a></td> 48 49<td>Read configuration options from the given file.</td> 50</tr> 51 52<tr> 53<td valign="top"><a href="usage.html#basedirectory"><code><b>-basedirectory</b></code></a> 54 <a href="usage.html#filename"><i>directoryname</i></a></td> 55 56<td>Specifies the base directory for subsequent relative file names.</td> 57</tr> 58 59<tr> 60<td valign="top"><a href="usage.html#injars"><code><b>-injars</b></code></a> 61 <a href="usage.html#classpath"><i>class_path</i></a></td> 62<td>Specifies the program jars (or wars, ears, zips, or directories).</td> 63</tr> 64 65<tr> 66<td valign="top"><a href="usage.html#outjars"><code><b>-outjars</b></code></a> 67 <a href="usage.html#classpath"><i>class_path</i></a></td> 68<td>Specifies the names of the output jars (or wars, ears, zips, or 69 directories).</td> 70</tr> 71 72<tr> 73<td valign="top"><a href="usage.html#libraryjars"><code><b>-libraryjars</b></code></a> 74 <a href="usage.html#classpath"><i>class_path</i></a></td> 75<td>Specifies the library jars (or wars, ears, zips, or directories).</td> 76</tr> 77 78<tr> 79<td valign="top"><a href="usage.html#skipnonpubliclibraryclasses"><code><b>-skipnonpubliclibraryclasses</b></code></a></td> 80<td>Ignore non-public library classes.</td> 81</tr> 82 83<tr> 84<td valign="top"><a href="usage.html#dontskipnonpubliclibraryclasses"><code><b>-dontskipnonpubliclibraryclasses</b></code></a></td> 85<td>Don't ignore non-public library classes (the default).</td> 86</tr> 87 88<tr> 89<td valign="top"><a href="usage.html#dontskipnonpubliclibraryclassmembers"><code><b>-dontskipnonpubliclibraryclassmembers</b></code></a></td> 90<td>Don't ignore package visible library class members.</td> 91</tr> 92 93<tr> 94<td valign="top"><a href="usage.html#keepdirectories"><code><b>-keepdirectories</b></code></a> 95 [<a href="usage.html#filters"><i>directory_filter</i></a>]</td> 96<td>Keep the specified directories in the output jars (or wars, ears, zips, or 97 directories).</td> 98</tr> 99 100<tr> 101<td valign="top"><a href="usage.html#target"><code><b>-target</b></code></a> 102 <i>version</i></td> 103<td>Set the given version number in the processed classes.</td> 104</tr> 105 106<tr> 107<td valign="top"><a href="usage.html#forceprocessing"><code><b>-forceprocessing</b></code></a></td> 108<td>Process the input, even if the output seems up to date.</td> 109</tr> 110 111<tr> 112<td valign="top"><a href="usage.html#keep"><code><b>-keep</b></code></a> 113 [<a href="usage.html#keepoptionmodifiers">,<i>modifier</i></a>,...] 114 <a href="usage.html#classspecification"><i>class_specification</i></a></td> 115<td>Preserve the specified classes <i>and</i> class members.</td> 116 117</tr> 118<tr> 119<td valign="top"><a href="usage.html#keepclassmembers"><code><b>-keepclassmembers</b></code></a> 120 [<a href="usage.html#keepoptionmodifiers">,<i>modifier</i></a>,...] 121 <a href="usage.html#classspecification"><i>class_specification</i></a></td> 122<td>Preserve the specified class members, if their classes are preserved as 123 well.</td> 124</tr> 125 126<tr> 127<td valign="top"><a href="usage.html#keepclasseswithmembers"><code><b>-keepclasseswithmembers</b></code></a> 128 [<a href="usage.html#keepoptionmodifiers">,<i>modifier</i></a>,...] 129 <a href="usage.html#classspecification"><i>class_specification</i></a></td> 130<td>Preserve the specified classes <i>and</i> class members, if all of the 131 specified class members are present.</td> 132</tr> 133 134<tr> 135<td valign="top"><a href="usage.html#keepnames"><code><b>-keepnames</b></code></a> 136 <a href="usage.html#classspecification"><i>class_specification</i></a></td> 137<td>Preserve the names of the specified classes <i>and</i> class members (if 138 they aren't removed in the shrinking step).</td> 139</tr> 140 141<tr> 142<td valign="top"><a href="usage.html#keepclassmembernames"><code><b>-keepclassmembernames</b></code></a> 143 <a href="usage.html#classspecification"><i>class_specification</i></a></td> 144<td>Preserve the names of the specified class members (if they aren't removed 145 in the shrinking step).</td> 146</tr> 147 148<tr> 149<td valign="top"><a href="usage.html#keepclasseswithmembernames"><code><b>-keepclasseswithmembernames</b></code></a> 150 <a href="usage.html#classspecification"><i>class_specification</i></a></td> 151<td>Preserve the names of the specified classes <i>and</i> class members, if 152 all of the specified class members are present (after the shrinking 153 step).</td> 154</tr> 155 156<tr> 157<td valign="top"><a href="usage.html#printseeds"><code><b>-printseeds</b></code></a> 158 [<a href="usage.html#filename"><i>filename</i></a>]</td> 159<td>List classes and class members matched by the various <code>-keep</code> 160 options, to the standard output or to the given file.</td> 161</tr> 162 163<tr> 164<td valign="top"><a href="usage.html#dontshrink"><code><b>-dontshrink</b></code></a></td> 165<td>Don't shrink the input class files.</td> 166</tr> 167 168<tr> 169<td valign="top"><a href="usage.html#printusage"><code><b>-printusage</b></code></a> 170 [<a href="usage.html#filename"><i>filename</i></a>]</td> 171<td>List dead code of the input class files, to the standard output or to the 172 given file.</td> 173</tr> 174 175<tr> 176<td valign="top"><a href="usage.html#whyareyoukeeping"><code><b>-whyareyoukeeping</b></code></a> 177 <a href="usage.html#classspecification"><i>class_specification</i></a></td> 178<td>Print details on why the given classes and class members are being kept in 179 the shrinking step.</td> 180</tr> 181 182<tr> 183<td valign="top"><a href="usage.html#dontoptimize"><code><b>-dontoptimize</b></code></a></td> 184<td>Don't optimize the input class files.</td> 185</tr> 186 187<tr> 188<td valign="top"><a href="usage.html#optimizations"><code><b>-optimizations</b></code></a> 189 <a href="optimizations.html"><i>optimization_filter</i></a></td> 190<td>The optimizations to be enabled and disabled.</td> 191</tr> 192 193<tr> 194<td valign="top"><a href="usage.html#optimizationpasses"><code><b>-optimizationpasses</b></code></a> 195 <i>n</i></td> 196<td>The number of optimization passes to be performed.</td> 197</tr> 198 199<tr> 200<td valign="top"><a href="usage.html#assumenosideeffects"><code><b>-assumenosideeffects</b></code></a> 201 <a href="usage.html#classspecification"><i>class_specification</i></a></td> 202<td>Assume that the specified methods don't have any side effects, while 203 optimizing.</td> 204</tr> 205 206<tr> 207<td valign="top"><a href="usage.html#allowaccessmodification"><code><b>-allowaccessmodification</b></code></a></td> 208<td>Allow the access modifiers of classes and class members to be modified, 209 while optimizing.</td> 210</tr> 211 212<tr> 213<td valign="top"><a href="usage.html#mergeinterfacesaggressively"><code><b>-mergeinterfacesaggressively</b></code></a></td> 214<td>Allow any interfaces to be merged, while optimizing.</td> 215</tr> 216 217<tr> 218<td valign="top"><a href="usage.html#dontobfuscate"><code><b>-dontobfuscate</b></code></a></td> 219<td>Don't obfuscate the input class files.</td> 220</tr> 221 222<tr> 223<td valign="top"><a href="usage.html#printmapping"><code><b>-printmapping</b></code></a> 224 [<a href="usage.html#filename"><i>filename</i></a>]</td> 225<td>Print the mapping from old names to new names for classes and class members 226 that have been renamed, to the standard output or to the given file.</td> 227</tr> 228 229<tr> 230<td valign="top"><a href="usage.html#applymapping"><code><b>-applymapping</b></code></a> 231 <a href="usage.html#filename"><i>filename</i></a></td> 232<td>Reuse the given mapping, for incremental obfuscation.</td> 233</tr> 234 235<tr> 236<td valign="top"><a href="usage.html#obfuscationdictionary"><code><b>-obfuscationdictionary</b></code></a> 237 <a href="usage.html#filename"><i>filename</i></a></td> 238<td>Use the words in the given text file as obfuscated field names and method names.</td> 239</tr> 240 241<tr> 242<td valign="top"><a href="usage.html#classobfuscationdictionary"><code><b>-classobfuscationdictionary</b></code></a> 243 <a href="usage.html#filename"><i>filename</i></a></td> 244<td>Use the words in the given text file as obfuscated class names.</td> 245</tr> 246 247<tr> 248<td valign="top"><a href="usage.html#packageobfuscationdictionary"><code><b>-packageobfuscationdictionary</b></code></a> 249 <a href="usage.html#filename"><i>filename</i></a></td> 250<td>Use the words in the given text file as obfuscated package names.</td> 251</tr> 252 253<tr> 254<td valign="top"><a href="usage.html#overloadaggressively"><code><b>-overloadaggressively</b></code></a></td> 255<td>Apply aggressive overloading while obfuscating.</td> 256</tr> 257 258<tr> 259<td valign="top"><a href="usage.html#useuniqueclassmembernames"><code><b>-useuniqueclassmembernames</b></code></a></td> 260<td>Ensure uniform obfuscated class member names for subsequent incremental 261 obfuscation.</td> </tr> 262 263<tr> 264<td valign="top"><a href="usage.html#dontusemixedcaseclassnames"><code><b>-dontusemixedcaseclassnames</b></code></a></td> 265<td>Don't generate mixed-case class names while obfuscating.</td> 266</tr> 267 268<tr> 269<td valign="top"><a href="usage.html#keeppackagenames"><code><b>-keeppackagenames</b></code></a> 270 [<i><a href="usage.html#filters">package_filter</a></i>]</td> 271<td>Keep the specified package names from being obfuscated.</td> 272</tr> 273 274<tr> 275<td valign="top"><a href="usage.html#flattenpackagehierarchy"><code><b>-flattenpackagehierarchy</b></code></a> 276 [<i>package_name</i>]</td> 277<td>Repackage all packages that are renamed into the single given parent 278 package.</td> 279</tr> 280 281<tr> 282<td valign="top"><a href="usage.html#repackageclasses"><code><b>-repackageclasses</b></code></a> 283 [<i>package_name</i>]</td> 284<td>Repackage all class files that are renamed into the single given 285 package.</td> 286</tr> 287 288<tr> 289<td valign="top"><a href="usage.html#keepattributes"><code><b>-keepattributes</b></code></a> 290 [<i><a href="usage.html#filters">attribute_filter</a></i>]</td> 291<td>Preserve the given optional attributes; typically 292 <code>Exceptions</code>, <code>InnerClasses</code>, 293 <code>Signature</code>, <code>Deprecated</code>, 294 <code>SourceFile</code>, <code>SourceDir</code>, 295 <code>LineNumberTable</code>, 296 <code>LocalVariableTable</code>, <code>LocalVariableTypeTable</code>, 297 <code>Synthetic</code>, <code>EnclosingMethod</code>, and 298 <code>*Annotation*</code>.</td> 299</tr> 300 301<tr> 302<td valign="top"><a href="usage.html#keepparameternames"><code><b>-keepparameternames</b></code></a></td> 303<td>Keep the parameter names and types of methods that are kept.</td> 304</tr> 305 306<tr> 307<td valign="top"><a href="usage.html#renamesourcefileattribute"><code><b>-renamesourcefileattribute</b></code></a> 308 [<i>string</i>]</td> 309<td>Put the given constant string in the <code>SourceFile</code> 310 attributes.</td> 311</tr> 312 313<tr> 314<td valign="top"><a href="usage.html#adaptclassstrings"><code><b>-adaptclassstrings</b></code></a> 315 [<a href="usage.html#filters"><i>class_filter</i></a>]</td> 316<td>Adapt string constants in the specified classes, based on the obfuscated 317 names of any corresponding classes.</td> 318</tr> 319 320<tr> 321<td valign="top"><a href="usage.html#adaptresourcefilenames"><code><b>-adaptresourcefilenames</b></code></a> 322 [<a href="usage.html#filefilters"><i>file_filter</i></a>]</td> 323<td>Rename the specified resource files, based on the obfuscated names of the 324 corresponding class files.</td> 325</tr> 326 327<tr> 328<td valign="top"><a href="usage.html#adaptresourcefilecontents"><code><b>-adaptresourcefilecontents</b></code></a> 329 [<a href="usage.html#filefilters"><i>file_filter</i></a>]</td> 330<td>Update the contents of the specified resource files, based on the 331 obfuscated names of the processed classes.</td> 332</tr> 333 334<tr> 335<td valign="top"><a href="usage.html#dontpreverify"><code><b>-dontpreverify</b></code></a></td> 336<td>Don't preverify the processed class files.</td> 337</tr> 338 339<tr> 340<td valign="top"><a href="usage.html#microedition"><code><b>-microedition</b></code></a></td> 341<td>Target the processed class files at Java Micro Edition.</td> 342</tr> 343 344<tr> 345<td valign="top"><a href="usage.html#verbose"><code><b>-verbose</b></code></a></td> 346<td>Write out some more information during processing.</td> 347</tr> 348 349<tr> 350<td valign="top"><a href="usage.html#dontnote"><code><b>-dontnote</b></code></a> 351 [<a href="usage.html#filters"><i>class_filter</i></a>]</td> 352<td>Don't print notes about potential mistakes or omissions in the 353 configuration.</td> 354</tr> 355 356<tr> 357<td valign="top"><a href="usage.html#dontwarn"><code><b>-dontwarn</b></code></a> 358 [<a href="usage.html#filters"><i>class_filter</i></a>]</td> 359<td>Don't warn about unresolved references at all.</td> 360</tr> 361 362<tr> 363<td valign="top"><a href="usage.html#ignorewarnings"><code><b>-ignorewarnings</b></code></a></td> 364<td>Print warnings about unresolved references, but continue processing 365 anyhow.</td> 366</tr> 367 368<tr> 369<td valign="top"><a href="usage.html#printconfiguration"><code><b>-printconfiguration</b></code></a> 370 [<a href="usage.html#filename"><i>filename</i></a>]</td> 371<td>Write out the entire configuration in traditional ProGuard style, to the 372 standard output or to the given file.</td> 373</tr> 374 375<tr> 376<td valign="top"><a href="usage.html#dump"><code><b>-dump</b></code></a> 377 [<a href="usage.html#filename"><i>filename</i></a>]</td> 378<td>Write out the internal structure of the processed class files, to the 379 standard output or to the given file.</td> 380</tr> 381 382</table> 383<p> 384Notes: 385<ul> 386 387<li><i>class_path</i> is a list of jars, wars, ears, zips, and directories, 388 with optional filters, separated by path separators.</li> 389<li><i>filename</i> can contain Java system properties delimited by 390 '<b><</b>' and '<b>></b>'.</li> 391<li>If <i>filename</i> contains special characters, the entire name 392 should be quoted with single or double quotes.</li> 393</ul> 394<p> 395 396<h2>Overview of <code>Keep</code> Options</h2> 397 398<table cellpadding="5"> 399 400<tr> 401<th>Keep</th> 402<td>From being removed or renamed</td> 403<td>From being renamed</td> 404</tr> 405 406<tr> 407<td>Classes and class members</td> 408<td bgcolor="#E0E0E0"><a href="usage.html#keep"><code>-keep</code></a></td> 409<td bgcolor="#E0E0E0"><a href="usage.html#keepnames"><code>-keepnames</code></a></td> 410</tr> 411 412<tr> 413<td>Class members only</td> 414<td bgcolor="#E0E0E0"><a href="usage.html#keepclassmembers"><code>-keepclassmembers</code></a></td> 415<td bgcolor="#E0E0E0"><a href="usage.html#keepclassmembernames"><code>-keepclassmembernames</code></a></td> 416</tr> 417 418<tr> 419<td>Classes and class members, if class members present</td> 420<td bgcolor="#E0E0E0"><a href="usage.html#keepclasseswithmembers"><code>-keepclasseswithmembers</code></a></td> 421<td bgcolor="#E0E0E0"><a href="usage.html#keepclasseswithmembernames"><code>-keepclasseswithmembernames</code></a></td> 422</tr> 423 424</table> 425<p> 426 427<h2>Keep Option Modifiers</h2> 428 429<table cellspacing="10"> 430 431<tr> 432<td valign="top"><a href="usage.html#includedescriptorclasses"><code><b>includedescriptorclasses</b></code></a></td> 433<td>Also keep any classes in the descriptors of specified fields and methods. 434</tr> 435 436<td valign="top"><a href="usage.html#allowshrinking"><code><b>allowshrinking</b></code></a></td> 437<td>Allow the specified entry points to be removed in the shrinking step.</td> 438</tr> 439 440<tr> 441<td valign="top"><a href="usage.html#allowoptimization"><code><b>allowoptimization</b></code></a></td> 442<td>Allow the specified entry points to be modified in the optimization 443 step.</td> 444</tr> 445 446<tr> 447<td valign="top"><a href="usage.html#allowobfuscation"><code><b>allowobfuscation</b></code></a></td> 448<td>Allow the specified entry points to be renamed in the obfuscation step.</td> 449</tr> 450 451</table> 452<p> 453 454<h2>Class Specifications</h2> 455 456<pre> 457[<b>@</b><i>annotationtype</i>] [[<b>!</b>]<b>public</b>|<b>final</b>|<b>abstract</b> ...] [<b>!</b>]<b>interface</b>|<b>class</b> <i>classname</i> 458 [<b>extends</b>|<b>implements</b> [<b>@</b><i>annotationtype</i>] <i>classname</i>] 459[<b>{</b> 460 [<b>@</b><i>annotationtype</i>] [[<b>!</b>]<b>public</b>|<b>private</b>|<b>protected</b>|<b>static</b>|<b>volatile</b>|<b>transient</b> ...] <b><fields></b> | 461 (<i>fieldtype fieldname</i>)<b>;</b> 462 [<b>@</b><i>annotationtype</i>] [[<b>!</b>]<b>public</b>|<b>private</b>|<b>protected</b>|<b>static</b>|<b>synchronized</b>|<b>native</b>|<b>abstract</b>|<b>strictfp</b> ...] <b><methods></b> | 463 <b><init>(</b><i>argumenttype,...</i><b>)</b> | 464 <i>classname</i><b>(</b><i>argumenttype,...</i><b>)</b> | 465 (<i>returntype methodname</i><b>(</b><i>argumenttype,...</i><b>)</b>)<b>;</b> 466 [<b>@</b><i>annotationtype</i>] [[<b>!</b>]<b>public</b>|<b>private</b>|<b>protected</b>|<b>static</b> ... ] <b>*;</b> 467 ... 468<b>}</b>] 469</pre> 470<p> 471Notes: 472<ul> 473<li>Class names must always be fully qualified, i.e. including their package 474 names.</li> 475<li>Types in <i>classname</i>, <i>annotationtype</i>, <i>returntype</i>, and 476 <i>argumenttype</i> can contain wildcards: '<code><b>?</b></code>' for a 477 single character, '<code><b>*</b></code>' for any number of characters 478 (but not the package separator), '<code><b>**</b></code>' for any number 479 of (any) characters, '<code><b>%</b></code>' for any primitive type, 480 '<code><b>***</b></code>' for any type, and '<code><b>...</b></code>' for any number of arguments.</li> 481<li><i>fieldname</i> and <i>methodname</i> can contain wildcards as well: 482 '<code><b>?</b></code>' for a single character and '<code><b>*</b></code>' 483 for any number of characters.</li> 484</ul> 485 486<hr /> 487<address> 488Copyright © 2002-2014 489<a target="other" href="http://www.lafortune.eu/">Eric Lafortune</a> @ <a target="top" href="http://www.saikoa.com/">Saikoa</a>. 490</address> 491</body> 492</html> 493