【发布时间】:2016-08-05 10:15:51
【问题描述】:
我已将一些第三方源代码集成到我的 android 项目中,但在启用 proguard 的情况下构建它时遇到了麻烦。构建失败:
Warning: there were 123 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning: there were 201 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile the code.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)
Warning: Exception while processing task java.io.IOException: Please correct the above warnings first.
:app:transformClassesAndResourcesWithProguardForRelease FAILED
FAILURE: Build failed with an exception.
有许多注释和警告需要整理,我无法判断它的正面或反面。我已经尝试为似乎引起警告的所有内容添加--keep class example.package.** { *; },但它仍然失败。任何人都可以提出处理此类问题的策略吗?例如,如果我看到这个:
Warning: info.guardianproject.netcipher.client.MyDefaultClientConnectionOperator: can't find superclass or interface ch.boye.httpclientandroidlib.impl.conn.DefaultClientConnectionOperator
我该怎么办?
【问题讨论】:
-
要重现此问题,请将
compile 'info.guardianproject.netcipher:netcipher:1.2'添加到应用的 build.gradle 依赖项中。然后在你的代码中import info.guardianproject.netcipher.NetCipher;和HttpsURLConnection con = NetCipher.getHttpsURLConnection(url); -
@ban-geoengineering 请查看下面的答案以及这些链接:proguard.sourceforge.net/manual/troubleshooting.htmlgithub.com/krschultz/android-proguard-snippets
标签: android build proguard minify android-proguard