使用Proguard的和摇篮Android编译失败 [英] Android Build fails using Proguard and Gradle

查看:261
本文介绍了使用Proguard的和摇篮Android编译失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近转换的一个项目,从日食/蚂蚁采用Android工作室/摇篮。我的调试版本工作正常,但是当我试图做一个发布版本使用ProGuard启动失败,出现以下错误

I have recently converted a project from eclipse/ant to using Android Studio/Gradle. My debug build works fine but when I attempt to do a release build with proguard enabled it fails with the following error

16:26:13.437 [ERROR] [system.err] Unexpected error while computing stack sizes:
16:26:13.438 [ERROR] [system.err]   Class       = [com/a/a/a/d/d]
16:26:13.438 [ERROR] [system.err]   Method      = [<clinit>()V]
16:26:13.438 [ERROR] [system.err]   Exception   = [java.lang.IllegalArgumentException] (Stack size becomes negative after instruction [143] swap in [com/a/a/a/d/d.<clinit>()V])

我已经使用了相同的proguard.txt我的Eclipse项目,它能正常工作,因此建议有某种问题的摇篮Android插件。有没有人遇到过类似的问题?我ProGuard的配置 - http://pastebin.com/2gsNUmeD 并充分摇篮输出的 http://pastebin.com/TAvMUSrR

I have used the same proguard.txt for my eclipse project and it worked fine so it suggests there is some kind of problem with the Gradle Android plugin. Has anyone encountered a similar problem? My proguard config - http://pastebin.com/2gsNUmeD and full gradle output http://pastebin.com/TAvMUSrR

推荐答案

ProGuard的的确应该在相同的蚂蚁,Eclipse和摇篮的行为。你应该检查你的建造使用不同版本的ProGuard的。您可以在控制台中看到日志的版本。如果您知道哪个ProGuard的罐子被使用,还可以键入 Java的罐子proguard.jar 来获取版本。

ProGuard should indeed behave identically in Ant, Eclipse, and Gradle. You should check if your builds use different versions of ProGuard. You can see the version in the console log. If you know which ProGuard jar is being used, you can also type java -jar proguard.jar to get the version.

该错误信息显示在ProGuard的的优化步骤中的错误。但愿错误发生在一个较旧的版本,而不是较新版本。然后,您可以简单地升级的罐子。否则,您可以在的ProGuard的bug跟踪,$ P $重现问题。作为一种变通方法,您可以禁用优化的选项 -dontoptimize

The error message suggests a bug in ProGuard's optimization step. Hopefully the bug occurs in an older version and not in newer versions. You can then simply upgrade the jar. Otherwise, you can report it on ProGuard's bug tracker, preferably with sufficient information to reproduce the problem. As a workaround, you can disable optimization with the option -dontoptimize.

这篇关于使用Proguard的和摇篮Android编译失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆