【发布时间】:2017-10-16 18:14:06
【问题描述】:
我得到的错误是:(这是一个大项目)
Note: there were 10 references to unknown classes.
You should check your configuration for typos.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
Note: there were 239 unkept descriptor classes in kept class members.
You should consider explicitly keeping the mentioned classes
(using '-keep').
(http://proguard.sourceforge.net/manual/troubleshooting.html#descriptorclass)
Note: there were 27 unresolved dynamic references to classes or interfaces.
You should check if you need to specify additional program jars.
(http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)
Warning: there were 2292 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 241 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:transformClassesAndResourcesWithProguardForDebug FAILED
FAILURE: Build failed with an exception.
Gradle 有一个很大的日志输出,我知道我最终必须清理 proguard-rules.pro,但为什么它在 android 6.0.1 上运行而不在 android 4.4.2 上运行。日志以“构建失败并出现异常”结尾,我尝试“使用 --stacktrace 运行”但看不到异常
【问题讨论】:
-
work on android 6.0.1 and not on android 4.4.2是什么意思?如果您的代码需要 SDK 23 才能编译,并且您将compileSdkVersion设置为更低的值,则会缺少类。问题是,你为什么要降低compileSdkVersion?也许您打算改为更改targetSdkVersion或minSdkVersion。 -
我的应用构建 gradle 有 ` compileSdkVersion 26 , buildToolsVersion "25.0.3" , minSdkVersion 16 , targetSdkVersion 26 `
-
我可以在 android 6.0.1 Marshmallow api 23 上运行该应用程序,但不能在 4.4.2 上运行。
-
这可能是因为您的项目中有太多方法引用,Android 4 无法开箱即用地运行此类应用。您可以enable multidex,但您现在应该开始优化这些 proguard 规则,因为这对性能更好。
-
谢谢,我当然会优化。关于 multidex 我没有看到任何构建错误表明我的应用程序已达到 Android 构建架构的限制并且它确实在 api 23 上运行
标签: android exception proguard