Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The actual Proguard part finishes, but then dex cannot convert the resulting bytecode anymore. Dex considers the <code>LocalVariableTable</code> incorrect. Eric Lafortune is the better source to explain why (see his answer).</p> <p>The problem goes away if you not only don't obfuscate, but also skip the optimization step (<code>-dontoptimize</code>). But you want to have this for the size reduction. Another way to solve it is to drop the debug flags in <code>javac</code> and in <code>dex</code>. Only problem is that then you wouldn't have proper stacktraces either. You will get stacktrace lines without source file info or line numbers such as:</p> <pre><code>net.lp.collectionista.domain.items.book.BookItem.getCoverImageForFormField(Unkno‌​wn Source) </code></pre> <p>You can do this by adding <code>debug="false"</code> in the <code>javac</code> tag in the ant <code>main-rules.xml</code> (you may want to copy the part to a <code>build.xml</code> first). This will set a flag <code>javac -g:none</code>. You also have to configure dex and this is harder to do in the provided ant template. I copied the <code>dex-helper</code> macro, made sure it was being used, and added a condition tag surrounding the dex calls:</p> <pre><code> &lt;echo&gt;Converting compiled files and external libraries into ${intermediate.dex.file}...&lt;/echo&gt; &lt;if condition="debug"&gt; &lt;then&gt; &lt;apply executable="${dx}" failonerror="true" parallel="true"&gt; &lt;arg value="--dex" /&gt; &lt;arg value="--output=${intermediate.dex.file}" /&gt; &lt;extra-parameters /&gt; &lt;arg line="${verbose.option}" /&gt; &lt;arg path="${out.dex.input.absolute.dir}" /&gt; &lt;path refid="out.dex.jar.input.ref" /&gt; &lt;external-libs /&gt; &lt;/apply&gt; &lt;/then&gt; &lt;else&gt; &lt;apply executable="${dx}" failonerror="true" parallel="true"&gt; &lt;arg value="--dex" /&gt; &lt;arg value="--output=${intermediate.dex.file}" /&gt; &lt;arg value="--no-locals" /&gt;&lt;!-- otherwise dex fails on the proguard bytecode --&gt; &lt;extra-parameters /&gt; &lt;arg line="${verbose.option}" /&gt; &lt;arg path="${out.dex.input.absolute.dir}" /&gt; &lt;path refid="out.dex.jar.input.ref" /&gt; &lt;external-libs /&gt; &lt;/apply&gt; &lt;/else&gt; &lt;/if&gt; </code></pre> <p>It's the <code>--no-locals</code> that does it. </p> <p>To mitigate the loss of stacktrace information you can use, respectively for line number information and class and method names information:</p> <pre><code>-keepattributes SourceFile, LineNumberTable -keep,allowshrinking,allowoptimization class * { &lt;methods&gt;; } </code></pre> <p>This way you can do partial obfuscation, and still have equivalent good stacktraces. I still suggest you create and keep the mapping files upon release though.</p> <p>On top of all this you shouldn't specify <code>-keepattributes LocalVariableTable,LocalVariableTypeTable</code> and equally <code>-keepparameternames</code> (if you do obfuscate, this by itself might get you into troubles as well). Note that the second implies the first, even though it may not be clear from its name that it affects attributes.</p> <p>Personally, and in view of other problems with Proguard, I chose to do the obfuscation but mitigate the loss of stacktrace information. I haven't tried @plowman's proposal yet.</p> <p>For more details you can find my version controlled project files here:</p> <ul> <li><p><a href="http://bazaar.launchpad.net/~pjv/collectionista/trunk/view/head:/collectionista/proguard.cfg">proguard.cfg</a></p></li> <li><p><a href="http://bazaar.launchpad.net/~pjv/collectionista/trunk/view/head:/collectionista/build.xml">build.xml</a></p></li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload