The actual part of Proguard ends, but then dex can no longer convert the received bytecode. Dex considers LocalVariableTable . Eric Lafortune is the best source for explaining why (see His answer).
The problem goes away if you not only confuse, but also skip the optimization step ( -dontoptimize ). But you want to have this to reduce size. Another way to solve this is to clear the debug flags in javac and in dex . The only problem is that then you would not have the correct stacks either. You will get stacktrace lines without information about the file or line numbers, for example:
net.lp.collectionista.domain.items.book.BookItem.getCoverImageForFormField(Unknown Source)
You can do this by adding debug="false" to the javac tag in ant main-rules.xml (you can copy the part in build.xml ). This will set the javac -g:none flag. You also need to configure dex, and this is more difficult to do in the provided ant template. I copied the dex-helper macro, made sure it is being used, and added a condition tag surrounding the dex calls:
<echo>Converting compiled files and external libraries into ${intermediate.dex.file}...</echo> <if condition="debug"> <then> <apply executable="${dx}" failonerror="true" parallel="true"> <arg value="--dex" /> <arg value="--output=${intermediate.dex.file}" /> <extra-parameters /> <arg line="${verbose.option}" /> <arg path="${out.dex.input.absolute.dir}" /> <path refid="out.dex.jar.input.ref" /> <external-libs /> </apply> </then> <else> <apply executable="${dx}" failonerror="true" parallel="true"> <arg value="--dex" /> <arg value="--output=${intermediate.dex.file}" /> <arg value="--no-locals" /> <extra-parameters /> <arg line="${verbose.option}" /> <arg path="${out.dex.input.absolute.dir}" /> <path refid="out.dex.jar.input.ref" /> <external-libs /> </apply> </else> </if>
It does --no-locals .
To reduce the loss of stack information, you can use, respectively, for information about the line number and the names of classes and methods:
-keepattributes SourceFile, LineNumberTable -keep,allowshrinking,allowoptimization class * { <methods>; }
That way you can do partial obfuscation and still have equivalent good stacks. I still suggest that you create and store the mapping files after release.
On top of that, you should not specify -keepattributes LocalVariableTable,LocalVariableTypeTable and equally -keepparameternames (if you obfuscate, this in itself can also cause problems). Note that the second implies the first, even if it may not be clear from its name that it affects attributes.
Personally, and taking into account other problems with Proguard, I decided to do obfuscation, but reduced the loss of stack information. I haven't tried @plowman's suggestion yet.
For more information, you can find versioned files here: