【发布时间】:2012-03-05 10:38:34
【问题描述】:
首先,对不起,如果这个话题已经回答了,但我没有找到它......
我是 Android 和 Proguard 的新手。在我的应用程序开发结束时,我当然想使用 proguard 来减小它的大小。由于我在我的应用程序中使用来自 google api 客户端的一些库,因此我已将它们添加为外部 jar。
好吧,我的应用程序在没有通过 proguard 步骤的情况下运行正常,但是当我尝试导出它时,它开始让我头疼。很多我不知道如何跳过或安排的警告。像这样的:
[2012-03-05 07:20:06 - CollaJoveThreads] Proguard returned with error code 1. See console
[2012-03-05 07:20:06 - CollaJoveThreads] Warning: com.google.common.base.Equivalence: can't find referenced class javax.annotation.Nullable
[2012-03-05 07:20:06 - CollaJoveThreads] Warning: com.google.common.base.Equivalence: can't find referenced class javax.annotation.Nullable
[2012-03-05 07:20:06 - CollaJoveThreads] Warning: com.google.common.base.Equivalence: can't find referenced class javax.annotation.Nullable
[2012-03-05 07:20:06 - CollaJoveThreads] Warning: com.google.common.base.Equivalences$Impl$1: can't find referenced class javax.annotation.Nullable
[2012-03-05 07:20:06 - CollaJoveThreads] Warning: com.google.common.base.Equivalences$Impl$1: can't find referenced class javax.annotation.Nullable
还有更多类似的。
我已遵循 Google 开发人员的建议,并将这行添加到我的 proguard.cfg 中:
# Needed by google-api-client to keep generic types and @Key annotations accessed via reflection
-keepclassmembers class * {
@com.google.api.client.util.Key <fields>;
}
-keepattributes Signature,RuntimeVisibleAnnotations,AnnotationDefault,*Annotation*
-dontwarn sun.misc.Unsafe
但它继续出现所有这些警告消息。当我尝试使用“-dontwarn”选项时,我的应用程序崩溃了。
我已经阅读了这些问题以及更多内容:
谁能帮忙?
【问题讨论】:
-
对不起,我找到了:它缺少 'jsr305-1.3.9' jar 文件(我之前没有意识到)。谢谢大家。
标签: android proguard google-api-java-client