java - 使用 Proguard 混淆 Android 应用程序与 Dropbox.com 库

标签 java android dropbox proguard dropbox-api

我刚刚创建了一个需要 Dropbox.com API 库的 Android 应用程序。我现在正尝试在“发布”模式下构建应用程序,并希望在代码上运行 proguard 以混淆它。但是,每当我尝试运行 Proguard 时,都会收到以下错误:

Proguard returned with error code 1. See console
Warning: com.dropbox.client2.DropboxAPI: can't find referenced class org.json.simple.JSONArray
Warning: com.dropbox.client2.DropboxAPI: can't find referenced class org.json.simple.JSONArray
Warning: com.dropbox.client2.DropboxAPI$Entry: can't find referenced class org.json.simple.JSONArray
Warning: com.dropbox.client2.DropboxAPI$Entry: can't find referenced class org.json.simple.JSONArray
Warning: com.dropbox.client2.RESTUtility: can't find referenced class org.json.simple.parser.JSONParser
Warning: com.dropbox.client2.RESTUtility: can't find referenced class org.json.simple.parser.JSONParser
Warning: com.dropbox.client2.RESTUtility: can't find referenced class org.json.simple.parser.JSONParser
Warning: com.dropbox.client2.RESTUtility: can't find referenced class org.json.simple.parser.ParseException
Warning: there were 8 unresolved references to classes or interfaces.
         You may need to specify additional library jars (using '-libraryjars'),
         or perhaps the '-dontskipnonpubliclibraryclasses' option.
         java.io.IOException: Please correct the above warnings first.
         at proguard.Initializer.execute(Initializer.java:308)
         at proguard.ProGuard.initialize(ProGuard.java:210)
         at proguard.ProGuard.execute(ProGuard.java:85)
         at proguard.ProGuard.main(ProGuard.java:499)

我已经包含了“-dontskipnonpubliclibraryclasses”选项,但这对我一点帮助都没有。我尝试包括“-libraryjars”选项,但我可能一直在错误地使用它,因为我不确定我打算如何使用该标志。

有没有人知道如何纠正这个错误?现在,我无法在通过 Proguard 运行我的应用程序时构建它。任何帮助表示赞赏!谢谢!

最佳答案

比较。 ProGuard manual > Troubleshooting > Warning: can't find referenced class

com.dropbox 似乎依赖于 org.json。理论上,您应该因此将 org.json jar 添加到您的 libs 目录,以便它可以被处理并包含在您的应用程序中。实际上,您的应用程序在没有它的情况下也能正常工作,因此您可以让 ProGuard 忽略缺少的依赖项:

-dontwarn org.json.**

-dontwarn com.dropbox.**

您不应该添加 -libraryjars,因为您指定的任何 jar 都不会出现在 Android 设备上,除非您设法安装它们。

关于java - 使用 Proguard 混淆 Android 应用程序与 Dropbox.com 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8030532/

相关文章:

java - 文件过早结束 - XWPFDocument to PDFConverter

android - 在 Android 中分享图库中的图片

java - 将键绑定(bind)到 JButton

java - 无法在 Eclipse 中调试 Android 项目(adt 包)

java - 无法安装 ANT 来克隆 Volley 库

c# - 我如何使用 XmlTextReader 读取保管箱上的 xml 文件

java - 有没有适用于 java 的 Dropbox Sync 库?

ruby - 我应该如何处理 APP_KEY 和 APP_SECRET(Dropbox API)

Java Stream > 是否可以将 "orElseGet"内联到父流中?

android - 数据库中检测值的问题