如何修复Android Eclipse ProGuard Rule中的警告“找不到引用的类"? [英] How to fix warning 'can't find referenced class' in Android Eclipse ProGuard Rule?

查看:93
本文介绍了如何修复Android Eclipse ProGuard Rule中的警告“找不到引用的类"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Eclipse.在我的Android代码中,我使用了ProGuard.但是在导出APK时,我遇到了以下警告:

I am using Eclipse. In my Android code, I have used ProGuard. But while exporting the APK, I encountered the following warnings:

Proguard returned with error code 1. See console
Warning: okio.DeflaterSink: can't find referenced class     org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning: okio.Okio: can't find referenced class java.nio.file.Files
Warning: okio.Okio: can't find referenced class java.nio.file.Files
Warning: okio.Okio: can't find referenced class java.nio.file.Files
Warning: okio.Okio: can't find referenced class java.nio.file.Path
Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class java.nio.file.Path
Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning: okio.Okio: can't find referenced class java.nio.file.Path
Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class java.nio.file.Path
Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
       You should check if you need to specify additional program jars.
Warning: there were 14 unresolved references to classes or interfaces.
          You may need to specify additional library jars (using '-libraryjars').
java.io.IOException: Please correct the above warnings first.
at proguard.Initializer.execute(Initializer.java:321)
at proguard.ProGuard.initialize(ProGuard.java:211)
at proguard.ProGuard.execute(ProGuard.java:86)
at proguard.ProGuard.main(ProGuard.java:492)

怎么了?

推荐答案

您可以通过修改"progaurd-rules.pro"来解决此问题,这似乎是您使用Progaurd缩小代码的方式.

You can Solve that by modifying the 'progaurd-rules.pro' which seems that you are using Progaurd for Shrinking your Code.

您必须使用-dontwarn,但是在将其添加到proguard文件之前要小心,因为Proguard已经删除了一些未使用的类,因此测试不会出错

You must use -dontwarn But be careful before adding this to proguard file as there will not be errors at testing because Proguard had already delete some classes not being used

对于OKiO,请添加以下行

for case of OKiO add these lines

-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn okio.**

对于任何其他库,您可以看到此链接以进行进一步的proguard操作 https://github.com/krschultz/android-proguard-snippets

For any other library you can see this link for further proguard operations https://github.com/krschultz/android-proguard-snippets

这篇关于如何修复Android Eclipse ProGuard Rule中的警告“找不到引用的类"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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