When running ant extensions -Dproguard=1
in CMD, I am unable to ProGuard my extensions. This is the error I'm getting: Can't read [C:\Users\xx\Desktop\extension-template-master\lib\appinventor\apksigner.jar] (only DEFLATED entries can have EXT descriptor)
.
2 Likes
Can someone help me
Since no one could help me, I explored like Dora to fix the issue myself. I added these lines to the build.xml
file below these lines...
<injar file="${ExternalComponent-class.dir}/${extensionClassFolder}.jar" />
<outjar file="${ExternalComponent-class.dir}/${extensionClassFolder}_p.jar" />
I removed every <libraryJar
element, but kept the one for AndroidRuntime.jar
... This is what I replaced the previous lines for...
<libraryjar>
<fileset dir="${public.deps.dir}">
<include name="**/*.jar"/>
<exclude name="apksigner.jar"/>
</fileset>
</libraryjar>
Or you should just be able to remove the apksigner.jar
from the ProGuard area. At the end it should look like this...
<target name="ProGuard" unless="skipProguard">
<taskdef resource="proguard/ant/task.properties"
classpath="${lib.dir}/proguard/proguard.jar" />
<proguard printmapping="${public.build.dir}/proguard.map"
overloadaggressively="on"
configuration="${lib.dir}/proguard/proguard.cfg"
ignorewarnings="true">
<injar file="${ExternalComponent-class.dir}/${extensionClassFolder}.jar" />
<outjar file="${ExternalComponent-class.dir}/${extensionClassFolder}_p.jar" />
<!-- FOR DEVELOPER: Add the needed libraries for your extension right here
like the ones above, just after copying them to the deps
directory.
<libraryjar file="${public.deps.dir}/my-awesome-library.jar" /> -->
<libraryjar>
<fileset dir="${public.deps.dir}">
<include name="**/*.jar"/>
<exclude name="apksigner.jar"/>
</fileset>
</libraryjar>
<libraryjar file="${public.build.dir}/AndroidRuntime.jar" />
<dontnote filter="proguard.configuration.ConfigurationLogger" />
<adaptresourcefilecontents filter="proguard/ant/task.properties" />
</proguard>
<delete file="${ExternalComponent-class.dir}/${extensionClassFolder}.jar" />
<move file="${ExternalComponent-class.dir}/${extensionClassFolder}_p.jar"
tofile="${ExternalComponent-class.dir}/${extensionClassFolder}.jar" />
</target>
I removed the apksigner.jar
library from inclusion since when compiling extension, you don't need it.
If you used the extension-template-master
from Github
<libraryjar>
<fileset dir="lib">
<exclude name="appinventor/apksigner.jar"/>
<include name="**/*.jar"/>
<include name="**/*.aar"/>
<exclude name="*/dx.jar"/>
</fileset>
</libraryjar>
Or it will look like...
<target name="ProGuard" unless="skipProguard">
<taskdef resource="proguard/ant/task.properties"
classpath="lib/proguard/proguard.jar" />
<proguard printmapping="out/${extensionClassFolder}-proguard.map"
overloadaggressively="on"
configuration="lib/proguard/proguard.cfg"
ignorewarnings="true">
<injar file="${ExternalComponent-class.dir}/${extensionClassFolder}.jar" />
<outjar file="${ExternalComponent-class.dir}/${extensionClassFolder}_p.jar" />
<libraryjar>
<fileset dir="lib">
<exclude name="appinventor/apksigner.jar"/>
<include name="**/*.jar"/>
<include name="**/*.aar"/>
<exclude name="*/dx.jar"/>
</fileset>
</libraryjar>
<dontnote filter="proguard.configuration.ConfigurationLogger" />
<adaptresourcefilecontents filter="proguard/ant/task.properties" />
</proguard>
<delete file="${ExternalComponent-class.dir}/${extensionClassFolder}.jar" />
<move file="${ExternalComponent-class.dir}/${extensionClassFolder}_p.jar"
tofile="${ExternalComponent-class.dir}/${extensionClassFolder}.jar" />
</target>
8 Likes
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.