新增的ProGuard现在我不能建立一个发布版本 [英] Added ProGuard and now I can't build a release version

查看:247
本文介绍了新增的ProGuard现在我不能建立一个发布版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建我的应用程序的发布版本,然后决定我想用ProGuard的。添加以下到我的project.properties文件:

I built a release version of my app and then decided I wanted to use ProGuard. I added the following to my project.properties file:

proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt

当我尝试建立一个发布版本,我得到以下错误:

When I try to build a release version, I get the following errors:

[2012-11-28 17:47:37 - MyApp] Proguard returned with error code 1. See console
[2012-11-28 17:47:37 - MyApp] Warning: oauth.signpost.signature.OAuthMessageSigner: can't find referenced class org.apache.commons.codec.binary.Base64
[2012-11-28 17:47:37 - MyApp] Warning: oauth.signpost.signature.OAuthMessageSigner: can't find referenced class org.apache.commons.codec.binary.Base64
[2012-11-28 17:47:37 - MyApp] Warning: oauth.signpost.signature.OAuthMessageSigner: can't find referenced class org.apache.commons.codec.binary.Base64
[2012-11-28 17:47:37 - MyApp] Warning: oauth.signpost.signature.OAuthMessageSigner: can't find referenced class org.apache.commons.codec.binary.Base64
[2012-11-28 17:47:37 - MyApp] Warning: oauth.signpost.signature.OAuthMessageSigner: can't find referenced class org.apache.commons.codec.binary.Base64
[2012-11-28 17:47:37 - MyApp] Warning: there were 5 unresolved references to classes or interfaces.
[2012-11-28 17:47:37 - MyApp]          You may need to specify additional library jars (using '-libraryjars').
[2012-11-28 17:47:37 - MyApp] java.io.IOException: Please correct the above warnings first.
[2012-11-28 17:47:37 - MyApp]   at proguard.Initializer.execute(Initializer.java:321)
[2012-11-28 17:47:37 - MyApp]   at proguard.ProGuard.initialize(ProGuard.java:211)
[2012-11-28 17:47:37 - MyApp]   at proguard.ProGuard.execute(ProGuard.java:86)
[2012-11-28 17:47:37 - MyApp]   at proguard.ProGuard.main(ProGuard.java:492)

这显然是引用我使用的路标库。我相信我已经正确添加需要的jar和库,但我不这样想?

This is clearly referencing the signpost libraries I am using. I believe I have added the required jars and libraries correctly, but I guess not?

我通过添加外部JAR ...按钮添加路标罐子,并通过添加外部类文件夹...按钮添加commons- codeC库。

I added the signpost jars via the "Add External JARs..." button, and added the commons-codec library via the "Add External Class Folder..." button.

我在做什么错在这里?

更新:

我添加了一个名为ProGuard的-project.txt到项目的根。

I added a file called proguard-project.txt to the project's root.

proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

在proguard的-project.txt文件,我添加以下内容:

Inside the proguard-project.txt file, I added the following:

-keep class org.apache.** { *; }
-keep class oauth.signpost.** { *; }

我仍然收到同样的错误。

I am still receiving the same errors.

推荐答案

我不知道解释,但我有同样的问题与番石榴库,恰好有同样的警告消息。我做这个固定的:

I don't know the explanation, but I had the same problem with the guava libraries, having exactly this same warning message. I fixed it by doing this:

-dontwarn com.google.common.collect.MinMaxPriorityQueue

也通过AdMob类。一样。所以,也许你可以做同样的:

Also with AdMob classes. Same thing. So, perhaps you could do the same:

-dontwarn org.apache.commons.codec.binary.Base64

既然你成功地使用这些类在code了。

Since you're succesfully using those classes in your code already.

警告的:因为​​我不知道到底是什么这样做,谨慎行事,并可能尝试阅读一下吧

Warning: since I don't know exactly what this does, proceed with caution and possibly try reading about it.

这篇关于新增的ProGuard现在我不能建立一个发布版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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