Hello, I have test on 4.6 and 4.7beta,
I try to run proguard on an Android project contain classes.jar (library from Unity3d software) in attachement. I have error: Can't process class [com/unity3d/player/e$a$e.class] (Unknown verification type [69] in stack map frame
I tried to remove this file of output with: -injars libs/classes.jar(!com/unity3d/player/e$a$e.class)
But there is same issue on another file and I can't remove more than one file. I tried:
-injars libs/classes.jar(!com/unity3d/player/e$a$e.class;!com/unity3d/player/VideoPlayer.class)
-injars libs/classes.jar(!com/unity3d/player/e$a$e.class,!com/unity3d/player/VideoPlayer.class)
or with two lines
-injars libs/classes.jar(!com/unity3d/player/e$a$e.class)
-injars libs/classes.jar(!com/unity3d/player/VideoPlayer.class)
I attached wizard Android project with classes.jar in build path to test, can you help me? I don't understand why -dontpreverify don't disable verification. If I use proguard 3.9 it's work.
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
Last edit: Anonymous 2014-07-30
It appears two classes in the jar have corrupt StackMapTable attributes, which crashes the parsers in ProGuard and also in javap, e.g.:
javap -classpath libs/classes.jar com.unity3d.player.VideoPlayer
Is this the original library? The proper solution is to make sure the classes are fixed. They seem to be obfuscated, maybe with ProGuard even (?), but at least the latest version of ProGuard writes out class files that are not corrupt (unless it is misconfigured).
As a workaround in your project, you can let ProGuard ignore the StackMapTable attributes by modifying a definition in ClassConstants.java:
public static final String ATTR_StackMapTable = "dummy";
You can then rebuild it and replace the proguard.jar in the Android SDK.
The issue is still here with UnityPlayer.class. I'm a C# programmer and have just begun learning Java. Although I managed to modify TTR_StackMapTable = "dummy" in ClassConstants.java, it seems impossible to rebuild the proguard 5.1 source code that I downloaded.
I tried for hours, but it seems that I'm missing something that it's obvious for seasoned Java programmers. I tried creating a new Java Project in Eclipse and copying all the proguard src folder in the src folder in Eclipse, and the exporting to jar. With this, I get many compile warnings and errors. I think this is because the proguard.ant package uses many imports, such as import org.apache.tools.ant.*; And also package proguard.wtk imports com.sun.kvem.environment.Obfuscator; I've searched all over the net for these libraries, but can't find them to add them to the project.
Also, I tried from a command prompt: javac ProGuard.java from inside the src/proguard/ folder, and the process finishes with 61 errors.
Could someone help me with this please?
Panos,
Dont try to import it to Eclipse. You can just run the build using Ant on the build.xml. I actually wrote a blog post about this issue although I didnt cover that part in much detail it may help you: http://innodroid.com/blog/post/use-a-custom-proguard-build-with-gradle
Greg, thanks for the nice write-up in your blog. That should be a useful reference for anyone who runs into the issue. The modification in the ProGuard code avoids disables parsing the preverification metadata into their usual data structures (they are not relevant for Android). I'm still hoping the Unity3D developers will fix the library, so the problem stops popping up.
Great, thanks, I will update the post.
Greg, thanks for your reply and your pointers.
I used the build.xml file that I found in proguard5.1\build folder. Made only a few modifications, so for instance, gradle.jar1 pointed to the latest 2.2.1 version rather than the 2.1 version in the original file, etc. I also edited the build.properties file to point to the correct location of gradle.
Actually, I wasn't sure why I had to point it to gradle anyway, but since there were references in the original build.xml and build.properties, and since I had gradle already installed together with Android studio, I thought it would do no harm to have it in the build files.
What really gave me a hard time though, was finding the wtk plugin. After many hours of searching and experimenting, I realized that there are many versions of this plugin, and one of them is Sun Java Wireless Toolkit 2.5.2_01 for CLDC. I thought I had found the solution, but no, I still can't get it to work. I then found this page "JME Wireless Toolkit Integration":
http://proguard.sourceforge.net/manual/wtk.html
...and made the suggested edits to the ktools.properties file of the installed Sun Java Wireless Toolkit 2.5.2_01 but still I can't get it to obfuscate.
In my build.properties file I have the following:
gradle.home = "C:\Program Files\Android\Android Studio\gradle\gradle-2.2.1"
wtk.home = "C:\Program Files (x86)\Java\Wireless Toolkit 2.5.2._01"
But when I try to build, the first tasks complete successfully, so I get a proguard.jar file, but for the wtk I still get the error:
wtkplugin:
BUILD FAILED
...\proguard5.1\src\build.xml:170: Please set the value of the property wtk.home in the file build.properties, if you want to build the optional ProGuard WTK plugin.
Any ideas what might be causing this?
Eric, thank you for creating such a great tool as proguard, I'm sure I'll master how to use it sooner or later :) and I'm sorry for using a CLOSED bug report as a support forum (by the time I realized that this wasn't meant for support it was too late :))
Panos, I don't know what to do about that. I dont remember having any issues at all, and nothing about WTK. Maybe because I was using 5.0 and you are using 5.1 - Maybe you can try 5.0?
Panos,
If you're developing for Android in Android Studio, you only need the Gradle plugin. The WTK is used for creating Java midlets, which is a different world from the Android world. As the message mentions, it is optional, and you can ignore it for your work. You don't need the WTK.
If the build process can build the plugins, they are automatically added to proguard.jar.
This issue is occurring still, or again, with the Unity classes. I'm attaching the JAR file of classes that Unity uses in its latest release. With ProGuard 4.9, the problem persists; i.e., I get:
java.io.IOException: Can't read [.../libs] (Can't process class [com/unity3d/player/UnityPlayer.class] (Unknown verification type [230] in stack map frame))
at proguard.InputReader.readInput(InputReader.java:230)
at proguard.InputReader.readInput(InputReader.java:200)
at proguard.InputReader.readInput(InputReader.java:178)
at proguard.InputReader.execute(InputReader.java:78)
at proguard.ProGuard.readInput(ProGuard.java:196)
at proguard.ProGuard.execute(ProGuard.java:78)
at proguard.ProGuard.main(ProGuard.java:492)
I have tried to recompile ProGuard, replacing the values in ClassConstants.java as you directed two years ago, but the error persisted in that case.
I understand that this may still mean that the JAR file is corrupt in some way, but it would be very helpful for ProGuard to determine what the corruption is, since it still works fine and this is a rather cryptic error to work from. And, in my specific case, it would be great to either go back to the Unity folks with a description of how the JAR is malformed.
Alternatively, it would work to have a way of excluding this JAR from all verification; using -nopreverify didn't help.
The problem is still the same, and the workaround still works for me. You have to make sure that you recompile all ProGuard classes, not just ClassConstants.java.
The Unity3D library contains class files that have corrupt StackMapTable attributes. This can happen if the library has been post-processed with a tool that doesn't handle these attributes correctly. If the developers are using ProGuard, they should make sure that they use a reasonably recent version and that they let it perform preverification (that is, don't specify "-dontpreverify").
Thanks. I re-patched ProGuard and it works now. I've also passed your diagnosis on to the Unity team-- hopefully they address this promptly.
Same trouble with this, and I want to ask,
How did you 're-patched' ProGuard?
Could you tell me how did you make it through?
(I'm using proguard included in android SDK.)
Many thanks.
Last edit: Bum-Joon 2013-08-12
Well, you do as Eric said-- you open ClassConstants.java, put "dummy" as the value for the affected definitions, and just rebuild the project. Take the new JAR, drop it in the Android SDK. Works fine.
I'm stuck at step 'just rebuild the project'.
(Maybe I don't have much experiense on java...or just a fool)
I tried it through eclipse, and tried to export the JAR file.
But it failed with a message
'Unable to get package fragment root: proguard/classfile/ClassConstants.java'
I also tried on command line prompt
jar cf proguard *.java
javac -d . *.java
And it made a hundreds of errors saying,
'........does not exists' or
'cannot find symbol'
I'm still looking for a proper way to build it.
Little help would be greatly appreciated.
Last edit: Bum-Joon 2013-08-13
Could you tell me how did you made the JAR file?
I've tried, but keep failed...
Last edit: Bum-Joon 2013-08-15
I am facing this issue as well. I would like to somehow exclude the unity jar. I do not have the option of modifying the proguard source code.
Last edit: Salman 2013-12-18
Can I ask you a question: if that "UnityClasses.jar" is not your library, but a third-party library, why you force ProGuard to process it? Perhaps if you treat that third-party library as some part of Java Runtime, the problem vanishes. Just use "-libraryjars" option for that corrupted library, so ProGuard doesn't have to fully process it.
If that doesn't help, the only option is to obtain a non-corrupted version of that library, I guess. You can't ask ProGuard to successfully process a damaged bytecode.
Anybody get this to work with Android Studio/Gradle build?
I was able to patch and compile proguard, but I can't seem to get gradle to use my proguard.jar. I replaced the one in the Android SDK directory, but it doesn't seem to use that. In fact I can delete the jar file, and the gradle build still runs and fails at the same point.
Anybody got this working with gradle?
The Ant/Eclipse builds use android-sdk/tools/proguard/lib/proguard.jar.
The Gradle build depends on the ProGuard jars from Maven Central. You should look into overriding that dependency -- I don't know how off-hand.
If you install a patched ProGuard in your local maven repository and
include
mavenLocal()
in your buildscript.repositories, I believe thebuild will use your patched version.
On Wed, Sep 10, 2014 at 2:48 PM, Eric Lafortune lafortune@users.sf.net
wrote:
Related
Bugs:
#420Thanks for the tips. Your suggestion did put me on the right path and I did get this work, although I didn't need to use a local maven install. I put proguard.jar in a directory named "proguard" and setup the gradle file like this:
buildscript {
repositories {
flatDir { dirs 'proguard' }
mavenCentral()
}
dependencies {
classpath 'proguard.io:proguard:5.0'
classpath 'com.android.tools.build:gradle:0.12.+'
}
}