解决Android打包使用Progurad出现Can't process class...异常

  第一次写博客,呵呵……

  为什么会写这篇文章 是因为记录下问题,花了一天的时间来解决,有点坑

  出现这个问题后,网上搜了很多资料,不是没答案就是没有用处。最后找到了这个网址:http://sourceforge.net/p/proguard/bugs/420/?page=0,也就是proguard官网反馈bug的地方。从这得到一个教训,开源的东西出了问题的话,一定首先要去官网上去看看问题反馈。

  解决方法就是根据Eric Lafortune的建议:

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.


具体的翻译我也就不写了,相信大家都能看懂,问题产生的原因和解决办法都描述了。

解决办法:所要做的就是重新编译下Proguard源码,修改下ClassConstants.java的ATTR_StackMapTable变量值,导出jar包。

替换sdk目录下的tools/proguard/lib/proguard.jar文件, 名字要相同。


这样就成功解决~


你可能感兴趣的:(Android)