summaryrefslogtreecommitdiff
path: root/docs/manual/troubleshooting.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/manual/troubleshooting.html')
-rw-r--r--docs/manual/troubleshooting.html417
1 files changed, 343 insertions, 74 deletions
diff --git a/docs/manual/troubleshooting.html b/docs/manual/troubleshooting.html
index d3ed14e..964a25e 100644
--- a/docs/manual/troubleshooting.html
+++ b/docs/manual/troubleshooting.html
@@ -1,10 +1,21 @@
-<!doctype html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!doctype html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta http-equiv="content-style-type" content="text/css">
<link rel="stylesheet" type="text/css" href="style.css">
<title>ProGuard Troubleshooting</title>
+<script type="text/javascript" language="JavaScript">
+<!--
+if (window.self==window.top)
+ window.top.location.replace("../index.html#"+window.location.pathname+window.location.hash);
+else {
+ var hash="#"+window.location.pathname.replace(window.top.location.pathname.replace("index.html", ""), "");
+ if (window.top.location.hash!=hash)
+ window.top.location.hash=hash;
+}
+//-->
+</script>
</head>
<body>
@@ -15,23 +26,32 @@ few problems. The following sections discuss some common issues and solutions:
<h3><a href="#processing">Problems while processing</a></h3>
<ul>
-<li><a href="#dynamicalclass">Note: can't find dynamically referenced class</a></li>
+<li><a href="#dynamicalclass">Note: can't find dynamically referenced class ...</a></li>
<li><a href="#dynamicalclasscast">Note: ... calls '(...)Class.forName(variable).newInstance()'</a></li>
<li><a href="#dynamicalclassmember">Note: ... accesses a field/method '...' dynamically</a></li>
+<li><a href="#unknownclass">Note: the configuration refers to the unknown class '...'</a></li>
<li><a href="#descriptorclass">Note: the configuration keeps the entry point '...', but not the descriptor class '...'</a></li>
+<li><a href="#classmembers">Note: the configuration doesn't specify which class members to keep for class '...'</a></li>
<li><a href="#duplicateclass">Note: duplicate definition of program/library class</a></li>
<li><a href="#duplicatezipentry">Warning: can't write resource ... Duplicate zip entry</a></li>
<li><a href="#unresolvedclass">Warning: can't find superclass or interface</a></li>
<li><a href="#unresolvedclass">Warning: can't find referenced class</a></li>
-<li><a href="#unresolvedclassmember">Warning: can't find referenced field/method</a></li>
+<li><a href="#superclass">Error: Can't find any super classes of ... (not even immediate super class ...)</a></li>
+<li><a href="#superclass">Error: Can't find common super class of ... and ...</a></li>
+<li><a href="#unresolvedprogramclassmember">Warning: can't find referenced field/method '...' in program class ...</a></li>
+<li><a href="#unresolvedlibraryclassmember">Warning: can't find referenced field/method '...' in library class ...</a></li>
<li><a href="#unresolvedenclosingmethod">Warning: can't find enclosing class/method</a></li>
<li><a href="#dependency">Warning: library class ... depends on program class ...</a></li>
<li><a href="#unexpectedclass">Warning: class file ... unexpectedly contains class ...</a></li>
<li><a href="#mappingconflict1">Warning: ... is not being kept as ..., but remapped to ...</a></li>
<li><a href="#mappingconflict2">Warning: field/method ... can't be mapped to ...</a></li>
+<li><a href="#unsupportedclassversion">Error: Unsupported class version number</a></li>
<li><a href="#keep">Error: You have to specify '-keep' options</a></li>
<li><a href="#filename">Error: Expecting class path separator ';' before 'Files\Java\...' (in Windows)</a></li>
<li><a href="#macosx">Error: Can't read [.../lib/rt.jar] (No such file or directory) (in MacOS X)</a></li>
+<li><a href="#cantread">Error: Can't read ...</a></li>
+<li><a href="#cantwrite">Error: Can't write ...</a></li>
+<li><a href="#startinggui">Internal problem starting the ProGuard GUI (Cannot write XdndAware property) (in Linux)</a></li>
<li><a href="#outofmemoryerror">OutOfMemoryError</a></li>
<li><a href="#stackoverflowerror">StackOverflowError</a></li>
<li><a href="#unexpectederror">Unexpected error</a></li>
@@ -45,6 +65,13 @@ few problems. The following sections discuss some common issues and solutions:
<li><a href="#notobfuscated">Variable names not being obfuscated</a></li>
</ul>
+<h3><a href="#dalvik">Problems while converting to Android Dalvik bytecode</a></h3>
+
+<ul>
+<li><a href="#simexception">SimException: local variable type mismatch</a></li>
+<li><a href="#conversionerror">Conversion to Dalvik format failed with error 1</a></li>
+</ul>
+
<h3><a href="#preverifying">Problems while preverifying for Java Micro Edition</a></h3>
<ul>
@@ -56,9 +83,12 @@ few problems. The following sections discuss some common issues and solutions:
<li><a href="#stacktraces">Stack traces without class names or line numbers</a></li>
<li><a href="#noclassdeffounderror">NoClassDefFoundError</a></li>
<li><a href="#classnotfoundexception">ClassNotFoundException</a></li>
+<li><a href="#nosuchfieldexception">NoSuchFieldException</a></li>
<li><a href="#nosuchmethodexception">NoSuchMethodException</a></li>
<li><a href="#missingresourceexception">MissingResourceException or NullPointerException</a></li>
+<li><a href="#disappearingannotations">Disappearing annotations</a></li>
<li><a href="#invalidjarfile">Invalid or corrupt jarfile</a></li>
+<li><a href="#invalidjarindexexception">InvalidJarIndexException: Invalid index</a></li>
<li><a href="#invalidclassexception2">InvalidClassException, class loading error, or verification error (in Java Micro Edition)</a></li>
<li><a href="#nosuchfieldormethod">Error: No Such Field or Method, Error verifying method (in a Java Micro Edition emulator)</a></li>
<li><a href="#failingmidlets">Failing midlets (on a Java Micro Edition device)</a></li>
@@ -67,23 +97,23 @@ few problems. The following sections discuss some common issues and solutions:
<li><a href="#classcastexception">ClassCastException: class not an enum</a></li><li><a href="#classcastexception">IllegalArgumentException: class not an enum type</a></li>
<li><a href="#arraystoreexception">ArrayStoreException: sun.reflect.annotation.EnumConstantNotPresentExceptionProxy</a></li>
<li><a href="#compilererror">CompilerError: duplicate addition</a></li>
-<li><a href="#classformaterror">ClassFormatError: repetitive field name/signature</a></li>
+<li><a href="#classformaterror1">ClassFormatError: repetitive field name/signature</a></li>
+<li><a href="#classformaterror2">ClassFormatError: Invalid index in LocalVariableTable in class file</a></li>
<li><a href="#nosuchmethoderror">NoSuchMethodError or AbstractMethodError</a></li>
<li><a href="#verifyerror">VerifyError</a></li>
</ul>
-<a name="processing">&nbsp;</a>
-<h2>Problems while processing</h2>
+<h2><a name="processing">Problems while processing</a></h2>
ProGuard may print out some notes and non-fatal warnings:
<dl>
-<dt><a name="dynamicalclass"><b>Note: can't find dynamically referenced class</b></a></dt>
+<dt><a name="dynamicalclass"><b>Note: can't find dynamically referenced class ...</b></a></dt>
<dd>ProGuard can't find a class or interface that your code is accessing by
- means of introspection. You should check if you want to add the jar that
- contains this class.</dd>
+ means of introspection. You should consider adding the jar that contains
+ this class.</dd>
<dt><a name="dynamicalclasscast"><b>Note: ... calls '(...)Class.forName(variable).newInstance()'</b></a></dt>
@@ -107,6 +137,13 @@ ProGuard may print out some notes and non-fatal warnings:
notes by specifying the <a
href="usage.html#dontnote"><code>-dontnote</code></a> option.</dd>
+<dt><a name="unknownclass"><b>Note: the configuration refers to the unknown class '...'</b></a></dt>
+
+<dd>Your configuration refers to the name of a class that is not present in
+ the program jars or library jars. You should check whether the name is
+ correct. Notably, you should make sure that you always specify
+ fully-qualified names, not forgetting the package names.</dd>
+
<dt><a name="descriptorclass"><b>Note: the configuration keeps the entry point '...', but not the descriptor class '...'</b></a></dt>
<dd>Your configuration contains a <code>-keep</code> option to preserve the
@@ -118,6 +155,21 @@ ProGuard may print out some notes and non-fatal warnings:
API. You can switch off these notes by specifying the <a
href="usage.html#dontnote"><code>-dontnote</code></a> option.</dd>
+<dt><a name="classmembers"><b>Note: the configuration doesn't specify which class members to keep for class '...'</b></a></dt>
+
+<dd>Your configuration contains
+ a <a href="usage.html#keepclassmembers"><code>-keepclassmembers</code></a>/<a href="usage.html#keepclasseswithmembers">-keepclasseswithmembers</code></a>
+ option to preserve fields or methods in the given class, but it doesn't
+ specify which fields or methods. This way, the option simply won't have
+ any effect. You probably want to specify one or more fields or methods, as
+ usual between curly braces. You can specify all fields or methods with a
+ wildcard "<code>*;</code>". You should also consider if you just need the
+ more common <a href="usage.html#keep"><code>-keep</code></a> option, which
+ preserves all specified classes <i>and</i> class members.
+ The <a href="usage.html#keepoverview">overview of all <code>keep</code>
+ options</a> can help. You can switch off these notes by specifying
+ the <a href="usage.html#dontnote"><code>-dontnote</code></a> option.</dd>
+
<dt><a name="duplicateclass"><b>Note: duplicate definition of program/library class</b></a></dt>
<dd>Your program jars or library jars contain multiple definitions of the
@@ -126,7 +178,21 @@ ProGuard may print out some notes and non-fatal warnings:
though, so it's advisable to remove the duplicates. A convenient way to do
so is by specifying filters on the input jars or library jars. You can
switch off these notes by specifying the <a
- href="usage.html#dontnote"><code>-dontnote</code></a> option.</dd>
+ href="usage.html#dontnote"><code>-dontnote</code></a> option.
+ <p>
+ <img class="float" src="android_small.png" width="32" height="32"
+ alt="android" /> The standard Android build process automatically
+ specifies the input jars for you. There may not be an easy way to filter
+ them to remove these notes. You could remove the duplicate classes
+ manually from your libraries. You should never explicitly specify the
+ input jars yourself (with <code>-injars</code> or
+ <code>-libraryjars</code>), since you'll then get duplicate definitions.
+ You should also not add libraries to your application that are already
+ part of the Android run-time (notably <code>org.w3c.dom</code>,
+ <code>org.xml.sax</code>, <code>org.xmlpull.v1</code>,
+ <code>org.apache.commons.logging.Log</code>, <code>org.apache.http</code>,
+ and <code>org.json</code>). They are possibly inconsistent, and the
+ run-time libraries would get precedence anyway.</dd>
<dt><a name="duplicatezipentry"><b>Warning: can't write resource ... Duplicate zip entry</b></a></dt>
@@ -135,7 +201,13 @@ ProGuard may print out some notes and non-fatal warnings:
with previously used names. Once more, the warning may be an indication of
some problem though, so it's advisable to remove the duplicates. A
convenient way to do so is by specifying filters on the input jars. There
- is no option to switch off these warnings.</dd>
+ is no option to switch off these warnings.
+ <p>
+ <img class="float" src="android_small.png" width="32" height="32"
+ alt="android" /> The standard Android build process automatically
+ specifies the input jars for you. There may not be an easy way to filter
+ them to remove these warnings. You could remove the duplicate resource files
+ manually from the input and the libraries.</dd>
</dl>
<p>
@@ -146,60 +218,133 @@ some more serious warnings:
<dl>
<dt><a name="unresolvedclass"><b>Warning: can't find superclass or interface</b><br/><b>Warning: can't find referenced class</b></a></dt>
-<dd>If there are unresolved references to classes or interfaces, you most
- likely forgot to specify an essential library. For proper processing, all
- libraries that are referenced by your code must be specified, including
- the Java run-time library. For specifying libraries, use
- the <a href="usage.html#libraryjars"><code>-libraryjars</code></a> option.
+<dd>A class in one of your program jars or library jars is referring to a
+ class or interface that is missing from the input. The warning lists both
+ the referencing class(es) and the missing referenced class(es). There can
+ be a few reasons, with their own solutions:
<p>
- If the class that is reported as missing is a non-public library class,
- you should specify the <a
- href="usage.html#dontskipnonpubliclibraryclasses"><code>-dontskipnonpubliclibraryclasses</code></a>
- option. Common examples are the classes
- <code>javax.swing.TransferHandler$HasGetTransferHandler</code> and
- <code>java.util.zip.ZipConstants</code>, which are used as interfaces in
- some public classes, even though they are only package visible. This
- option is not set by default for reasons of efficiency. Setting it increases
- the processing time a bit, but it won't hurt the output in any way.
+ <ol>
+ <li>If the missing class is referenced from your own code, you may have
+ forgotten to specify an essential library. Just like when compiling
+ all code from scratch, you must specify all libraries that the code is
+ referencing, directly or indirectly. If the library should be
+ processed and included in the output, you should specify it with
+ <a href="usage.html#injars"><code>-injars</code></a>, otherwise you
+ should specify it with
+ <a href="usage.html#libraryjars"><code>-libraryjars</code></a>.
+ <p>
+ For example, if ProGuard complains that it can't find a
+ <code>java.lang</code> class, you have to make sure that you are
+ specifying the run-time library of your platform. For JSE, these are
+ typically packaged in <code>lib/rt.jar</code> (<code>vm.jar</code> for
+ IBM's JVM, and <code>classes.jar</code> in MacOS X). Other platforms
+ like JME and Android have their own run-time libraries.
+ The <a href="examples.html">examples section</a> provides more details
+ for the various platforms.
+ <p>
+ If ProGuard still complains that it can't find a
+ <code>javax.crypto</code> class, you probably still have to specify
+ <code>jce.jar</code>, next to the more common <code>rt.jar</code>.</li>
+ <li>If the missing class is referenced from a pre-compiled third-party
+ library, and your original code runs fine without it, then the missing
+ dependency doesn't seem to hurt. The cleanest solution is to
+ <a href="usage.html#filters">filter out</a> the <i>referencing</i>
+ class or classes from the input, with a filter like "<code>-libraryjars
+ mylibrary.jar(!somepackage/SomeUnusedReferencingClass.class)</code>".
+ ProGuard will then skip this class entirely in the input, and it will
+ not bump into the problem of its missing reference. However, you may
+ then have to filter out other classes that are in turn referencing the
+ removed class. In practice, this works best if you can filter out
+ entire unused packages at once, with a wildcard filter like
+ "<code>-libraryjars
+ mylibrary.jar(!someunusedpackage/**)</code>".<p></li>
+ <li>If you don't feel like filtering out the problematic classes, you can
+ try your luck with the <a
+ href="usage.html#ignorewarnings"><code>-ignorewarnings</code></a>
+ option, or even
+ the <a href="usage.html#dontwarn"><code>-dontwarn</code></a> option.
+ Only use these options if you really know what you're doing though.</li>
+ </ol>
<p>
- If you're missing a library and you're absolutely sure it isn't used
- anyway, you can try your luck with the <a
- href="usage.html#ignorewarnings"><code>-ignorewarnings</code></a> option,
- or even the <a href="usage.html#dontwarn"><code>-dontwarn</code></a>
- option. Only use these options if you really know what you're doing
- though.</dd>
-
-<dt><a name="unresolvedclassmember"><b>Warning: can't find referenced field/method</b></a></dt>
-
-<dd>If there are unresolved references to class members in input classes, your
- class files are most likely inconsistent. Possibly, some class file didn't
- get recompiled properly, or some class file was left behind after its
- source file was removed. Try removing all class files, recompiling them,
- zipping them up, and running ProGuard again.
+ <img class="float" src="android_small.png" width="32" height="32"
+ alt="android" /> The standard Android build process automatically
+ specifies the input jars for you. Unfortunately, many pre-compiled
+ third-party libraries refer to other libraries that are not actually used
+ and therefore not present. This works fine in debug builds, but in release
+ builds, ProGuard expects all libraries, so it can perform a proper static
+ analysis. For example, if ProGuard complains that it can't find
+ a <code>java.awt</code> class, then some library that you are using is
+ referring to <code>java.awt</code>. This is a bit shady, since Android
+ doesn't have this package at all, but if your application works anyway,
+ you can let ProGuard accept it with "<code>-dontwarn java.awt.**</code>",
+ for instance.</dd>
+
+<dt><a name="superclass"><b>Error: Can't find any super classes of ... (not even immediate super class ...)</b><br/><b>Error: Can't find common super class of ... and ...</b></a></dt>
+
+<dd>It seems like you tried to avoid the warnings from the previous paragraph
+ by specifying
+ <a href="usage.html#ignorewarnings"><code>-ignorewarnings</code></a>
+ or <a href="usage.html#dontwarn"><code>-dontwarn</code></a>, but it didn't
+ work out. ProGuard's optimization step and preverification step really
+ need the missing classes to make sense of the code. Preferably, you would
+ solve the problem by adding the missing library, as discussed. If you're
+ sure the class that references the missing class isn't used either, you
+ could also try filtering it out from the input, by adding a filter to the
+ corresponding <a href="usage.html#injars"><code>-injars</code></a> option:
+ "<code>-injars
+ myapplication.jar(!somepackage/SomeUnusedClass.class)</code>". As a final
+ solution, you could switch off optimization
+ (<a href="usage.html#dontoptimize"><code>-dontoptimize</code></a>) and
+ preverification
+ (<a href="usage.html#dontpreverify"><code>-dontpreverify</code></a>).</dd>
+
+<dt><a name="unresolvedprogramclassmember"><b>Warning: can't find referenced field/method '...' in program class ...</b></a></dt>
+
+<dd>A program class is referring to a field or a method that is missing from
+ another program class. The warning lists both the referencing class and
+ the missing referenced class member. Your compiled class files are most
+ likely inconsistent. Possibly, some class file didn't get recompiled
+ properly, or some class file was left behind after its source file was
+ removed. Try removing all compiled class files and rebuilding your
+ project.</dd>
+
+<dt><a name="unresolvedlibraryclassmember"><b>Warning: can't find referenced field/method '...' in library class ...</b></a></dt>
+
+<dd>A program class is referring to a field or a method that is missing from a
+ library class. The warning lists both the referencing class and the
+ missing referenced class member. Your compiled class files are
+ inconsistent with the libraries. You may need to recompile the class
+ files, or otherwise upgrade the libraries to consistent versions.
<p>
- If the class member that is reported as missing is actually implemented in
- a non-public library class, you should specify the
- <a href="usage.html#dontskipnonpubliclibraryclasses"><code>-dontskipnonpubliclibraryclasses</code></a> option. A common example is
- the method <code>setLength(int)</code> in the public class
- <code>java.lang.StringBuilder</code>. This method is actually defined in
- the package visible superclass
- <code>java.lang.AbstractStringBuilder</code>, which ProGuard ignores by
- default.
+ <img class="float" src="android_small.png" width="32" height="32"
+ alt="android" /> If you're developing for Android and ProGuard complains
+ that it can't find a method that is only available in a recent version of
+ the Android run-time, you should change the build target in your
+ <code>project.properties</code> file or <code>build.gradle</code> file to
+ that recent version. You can still specify a different
+ <code>minSdkVersion</code> and a different <code>targetSdkVersion</code>
+ in your <code>AndroidManifest.xml</code> file.
<p>
- If your program classes reside in the same packages as library classes,
- and refer to their package visible class members, then you should specify
- the <a
- href="usage.html#dontskipnonpubliclibraryclassmembers"><code>-dontskipnonpubliclibraryclassmembers</code></a>
+ Alternatively, you may get away with ignoring the inconsistency with the
+ options
+ <a href="usage.html#ignorewarnings"><code>-ignorewarnings</code></a> or
+ even
+ <a href="usage.html#dontwarn"><code>-dontwarn</code></a>. For instance, you
+ can specify "<code>-dontwarn mypackage.MyInconsistentClass</code>".
+ <p>
+ Finally, should your program classes reside in the same packages as
+ library classes and should they refer to their package visible class
+ members, then you should also specify the
+ <a href="usage.html#dontskipnonpubliclibraryclassmembers"><code>-dontskipnonpubliclibraryclassmembers</code></a>
option.</dd>
<dt><a name="unresolvedenclosingmethod"><b>Warning: can't find enclosing class/method</b></a></dt>
<dd>If there are unresolved references to classes that are defined inside
- methods in your input, once more, your class files are most likely
+ methods in your input, once more, your compiled class files are most likely
inconsistent. Possibly, some class file didn't get recompiled properly, or
some class file was left behind after its source file was removed. Try
- removing all class files, recompiling them, zipping them up, and running
- ProGuard again.</dd>
+ removing all compiled class files and rebuilding your project.</dd>
<dt><a name="dependency"><b>Warning: library class ... depends on program class ...</b></a></dt>
@@ -210,7 +355,20 @@ some more serious warnings:
classes always remain unchanged. It is therefore impossible to adapt
references from library classes to program classes, for instance if the
program classes are renamed. You should define a clean separation between
- program code and library code, and try again.</dd>
+ program code (specified with <a
+ href="usage.html#injars"><code>-injars</code></a>) and library code
+ (specified with <a
+ href="usage.html#libraryjars"><code>-libraryjars</code></a>), and try
+ again.
+ <p>
+ <img class="float" src="android_small.png" width="32" height="32"
+ alt="android" /> In Android development, sloppy libraries may contain
+ duplicates of classes that are already present in the Android run-time
+ (notably <code>org.w3c.dom</code>, <code>org.xml.sax</code>,
+ <code>org.xmlpull.v1</code>, <code>org.apache.commons.logging.Log</code>,
+ <code>org.apache.http</code>, and <code>org.json</code>). You must remove
+ these classes from your libraries, since they are possibly inconsistent,
+ and the run-time libraries would get precedence anyway.</dd>
<dt><a name="unexpectedclass"><b>Warning: class file ... unexpectedly contains class ...</b></a></dt>
@@ -257,6 +415,13 @@ some more serious warnings:
option in the initial obfuscation step, in order to reduce the risk of
conflicts.</dd>
+<dt><a name="unsupportedclassversion"><b>Error: Unsupported class version number</b></a></dt>
+
+<dd>You are trying to process class files compiled for a recent version of
+ Java that your copy of ProGuard doesn't support yet. You
+ should <a href="http://proguard.sourceforge.net/downloads.html">check
+ on-line</a> if there is a more recent release.</dd>
+
<dt><a name="keep"><b>Error: You have to specify '-keep' options</b></a></dt>
<dd>You either forgot to specify <a
@@ -266,7 +431,6 @@ some more serious warnings:
these. Without the proper seed specifications, ProGuard would shrink,
optimize, or obfuscate all class files away.</dd>
-
<dt><a name="filename"><b>Error: Expecting class path separator ';' before 'Files\Java\</b>...<b>'</b> (in Windows)</a></dt>
<dd>If the path of your run-time jar contains spaces, like in "Program Files",
@@ -282,6 +446,30 @@ some more serious warnings:
the path <code>&lt;java.home&gt;/lib/rt.jar</code> by
<code>&lt;java.home&gt;/../Classes/classes.jar</code>.</dd>
+<dt><a name="cantread"><b>Error: Can't read ...</b></a></dt>
+
+<dd>ProGuard can't read the specified file or directory. Double-check that the
+ name is correct in your configuration, that the file is readable, and that
+ it is not corrupt. An additional message "Unexpected end of ZLIB input
+ stream" suggests that the file is truncated. You should then make sure
+ that the file is complete on disk when ProGuard starts (asynchronous
+ copying? unflushed buffer or cache?), and that it is not somehow
+ overwritten by ProGuard's own output.</dd>
+
+<dt><a name="cantwrite"><b>Error: Can't write ...</b></a></dt>
+
+<dd>ProGuard can't write the specified file or directory. Double-check that
+ the name is correct in your configuration and that the file is
+ writable.</dd>
+
+<dt><a name="startinggui"><b>Internal problem starting the ProGuard GUI (Cannot write XdndAware property)</b> (in Linux)</a></dt>
+
+<dd>In Linux, at least with Java 6, the GUI may not start properly, due to
+ <a href="http://bugs.sun.com/view_bug.do?bug_id=7027598">Sun
+ Bug #7027598</a>. The work-around at this time is to specify the JVM
+ option <code>-DsuppressSwingDropSupport=true</code> when running the
+ GUI.</dd>
+
</dl>
<p>
@@ -304,7 +492,7 @@ Should ProGuard crash while processing your application:
size of the Java virtual machine (with the usual <code>-Xss</code> option)
should help too. In practice however, the <code>-Xss</code> setting
doesn't have any effect on the main thread, due to <a
- href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4362291">Sun Bug
+ href="http://bugs.sun.com/view_bug.do?bug_id=4362291">Sun Bug
#4362291</a>. As a result, this solution will only work when running
ProGuard in a different thread, e.g. from its GUI.</dd>
@@ -326,8 +514,7 @@ Should ProGuard crash while processing your application:
</dl>
<p>
-<a name="afterprocessing">&nbsp;</a>
-<h2>Unexpected observations after processing</h2>
+<h2><a name="afterprocessing">Unexpected observations after processing</a></h2>
If ProGuard seems to run fine, but your processed code doesn't look right,
there might be a couple of reasons:
@@ -363,7 +550,14 @@ there might be a couple of reasons:
<p>
If you are using marker interfaces to keep other classes, the marker
interfaces themselves are probably being removed in the shrinking step.
- You should therefore always explicitly keep any marker interfaces.</dd>
+ You should therefore always explicitly keep any marker interfaces, with
+ an option like "<code>-keep interface MyMarkerInterface</code>".
+ <p>
+ Similarly, if you are keeping classes based on annotations, you may have
+ to avoid that the annotation classes themselves are removed in the
+ shrinking step. You should package the annotation classes as a library, or
+ explicitly keep them in your program code with an option like "<code>-keep
+ @interface *</code>".</dd>
<dt><a name="notobfuscated"><b>Variable names not being obfuscated</b></a></dt>
@@ -377,8 +571,37 @@ there might be a couple of reasons:
</dl>
-<a name="preverifying">&nbsp;</a>
-<h2>Problems while preverifying for Java Micro Edition</h2>
+<h2><a name="dalvik">Problems while converting to Android Dalvik bytecode</a></h2>
+
+If ProGuard seems to run fine, but the dx tool in the Android SDK subsequently
+fails with an error:
+
+<dl>
+<dt><a name="simexception"><b>SimException: local variable type mismatch</b></a></dt>
+
+<dd>This error indicates that ProGuard's optimization step has not been able
+ to maintain the correct debug information about local variables. This can
+ happen if some code is optimized radically. Possible work-arounds: let the
+ java compiler not produce debug information (<code>-g:none</code>), or let
+ ProGuard's obfuscation step remove the debug information again
+ (by <i>not</i> keeping the attributes <code>LocalVariableTable</code>
+ and <code>LocalVariableTypeTable</code>
+ with <a href="usage.html#keepattributes"><code>-keepattributes</code></a>),
+ or otherwise just disable optimization
+ (<a href="usage.html#dontoptimize"><code>-dontoptimize</code></a>).</dd>
+
+<dt><a name="conversionerror"><b>Conversion to Dalvik format failed with error 1</b></a></dt>
+
+<dd>This error may have various causes, but if dx is tripping over some code
+ processed by ProGuard, you should make sure that you are using the latest
+ version of ProGuard. You can just copy the ProGuard jars
+ to <code>android-sdk/tools/proguard/lib</code>. If that doesn't help,
+ please report the problem, preferably with the simplest example that still
+ brings out the error.</dd>
+
+</dl>
+
+<h2><a name="preverifying">Problems while preverifying for Java Micro Edition</a></h2>
If ProGuard seems to run fine, but the external preverifier subsequently
produces errors, it's usually for a single reason:
@@ -409,8 +632,7 @@ Note that it is no longer necessary to use an external preverifier. With the
ProGuard will preverify the class files for Java Micro Edition.
<p>
-<a name="runtime">&nbsp;</a>
-<h2>Problems at run-time</h2>
+<h2><a name="runtime">Problems at run-time</a></h2>
If ProGuard runs fine, but your processed application doesn't work, there
might be several reasons:
@@ -439,14 +661,30 @@ might be several reasons:
class mypackage.MyClass</code>" or "<code>-keep class * implements
mypackage.MyInterface</code>".</dd>
+<dt><a name="nosuchfieldexception"><b>NoSuchFieldException</b></a></dt>
+
+<dd>Your code is probably calling something like
+ <code>myClass.getField</code>, trying to find some field dynamically.
+ Since ProGuard can't always detect this automatically, you have to keep
+ the missing field in using the
+ appropriate <a href="usage.html#keep"><code>-keep</code></a> option, e.g.
+ "<code>-keepclassmembers class mypackage.MyClass { int myField;
+ }</code>".</dd>
+
<dt><a name="nosuchmethodexception"><b>NoSuchMethodException</b></a></dt>
<dd>Your code is probably calling something like
<code>myClass.getMethod</code>, trying to find some method dynamically.
- Since ProGuard isn't detecting this (yet), you have to keep the missing
- method in using the appropriate <a
- href="usage.html#keep"><code>-keep</code></a> option, e.g. "<code>-keep
- class mypackage.MyClass { void myMethod(); }</code>".</dd>
+ Since ProGuard can't always detect this automatically, you have to keep
+ the missing method in using the
+ appropriate <a href="usage.html#keep"><code>-keep</code></a> option, e.g.
+ "<code>-keepclassmembers class mypackage.MyClass { void myMethod();
+ }</code>".
+ <p>
+ More specifically, if the method reported as missing is
+ <code>values</code> or <code>valueOf</code>, you probably have to keep
+ some methods related to <a
+ href="examples.html#enumerations">enumerations</a>.</dd>
<dt><a name="missingresourceexception"><b>MissingResourceException</b> or <b>NullPointerException</b></a></dt>
@@ -460,7 +698,18 @@ might be several reasons:
<p>
Furthermore, directory entries in jar files aren't copied, unless you
specify the option <a
- href="usage.html#keepdirectories"><code>-keepdirectories</code></a>.</dd>
+ href="usage.html#keepdirectories"><code>-keepdirectories</code></a>.
+ Note that Sun advises against calling <code>Class.getResource()</code> for
+ directories (<a href="http://bugs.sun.com/view_bug.do?bug_id=4761949">Sun
+ Bug #4761949</a>).</dd>
+
+<dt><a name="disappearingannotations"><b>Disappearing annotations</b></a></dt>
+
+<dd>By default, the obfuscation step removes all annotations. If your
+ application relies on annotations to function properly, you should
+ explicitly keep them with
+ <code><a href="usage.html#keepattributes">-keepattributes</a>
+ *Annotation*</code>.</dd>
<dt><a name="invalidjarfile"><b>Invalid or corrupt jarfile</b></a></dt>
@@ -474,6 +723,17 @@ might be several reasons:
manifest file is the one that is copied (the first manifest file that is
encountered), and that the main class is kept in your configuration,</dd>
+<dt><a name="invalidjarindexexception"><b>InvalidJarIndexException: Invalid index</b></a></dt>
+
+<dd>At least one of your processed jar files contains an index file
+ <code>META-INF/INDEX.LIST</code>, listing all class files in the jar.
+ ProGuard by default copies files like these unchanged. ProGuard may however
+ remove or rename classes, thus invalidating the file. You should filter the
+ index file out of the input
+ (<code>-injars in.jar(!META-INF/INDEX.LIST)</code>) or update the file
+ after having applied ProGuard (<code>jar -i out.jar</code>).
+ </dd>
+
<dt><a name="invalidclassexception2"><b>InvalidClassException</b>, <b>class loading error</b>, or <b>verification error</b> (in Java Micro Edition)</a></dt>
<dd>If you get such an error in Java Micro Edition, you may have forgotten to
@@ -526,7 +786,7 @@ might be several reasons:
<dd>You may have forgotten to sign your program jar <i>after</i> having
processed it with ProGuard.</dd>
-<dt><a name="classcastexception"><b>ClassCastException: class not an enum</b>, or <br><b>IllegalArgumentException: class not an enum type</b></a></dt>
+<dt><a name="classcastexception"><b>ClassCastException: class not an enum</b>, or <br /><b>IllegalArgumentException: class not an enum type</b></a></dt>
<dd>You should make sure you're preserving the special methods of enumeration
types, which the run-time environment calls by introspection. The required
@@ -548,7 +808,7 @@ might be several reasons:
<code>sun.tools.java.MethodSet.add</code> in Sun's JDK 1.2.2, which is
used for (dynamic) compilation. You should then avoid this option.</dd>
-<dt><a name="classformaterror"><b>ClassFormatError: repetitive field name/signature</b></a></dt>
+<dt><a name="classformaterror1"><b>ClassFormatError: repetitive field name/signature</b></a></dt>
<dd>You are probably processing some code that has been obfuscated before with
the <a
@@ -556,6 +816,14 @@ might be several reasons:
option. You should then use the same option again in the second processing
round.</dd>
+<dt><a name="classformaterror2"><b>ClassFormatError: Invalid index in LocalVariableTable in class file</b></a></dt>
+
+<dd>If you are keeping the <code>LocalVariableTable</code> or
+ <code>LocalVariableTypeTable</code> attributes, ProGuard's optimizing step
+ is sometimes unable to update them consistently. You should then let the
+ obfuscation step remove these attributes or disable the optimization
+ step.</dd>
+
<dt><a name="nosuchmethoderror"><b>NoSuchMethodError</b> or <b>AbstractMethodError</b></a></dt>
<dd>You should make sure you're not writing your output class files to a
@@ -583,10 +851,11 @@ might be several reasons:
</dl>
-<hr>
+<hr />
+<noscript><div><a target="_top" href="../index.html" class="button">Show menu</a></div></noscript>
<address>
-Copyright &copy; 2002-2009
-<a href="http://www.graphics.cornell.edu/~eric/">Eric Lafortune</a>.
+Copyright &copy; 2002-2013
+<a target="other" href="http://www.lafortune.eu/">Eric Lafortune</a>.
</address>
</body>
</html>