【问题标题】:Cant debug build app on android 4.4.2 but it works on android 6.0.1无法在 android 4.4.2 上调试构建应用程序,但它适用于 android 6.0.1
【发布时间】: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?也许您打算改为更改 targetSdkVersionminSdkVersion
  • 我的应用构建 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


【解决方案1】:

我解决了。 原因是在 app build gradle 中我使用的是 play-services 11.4.0 和 firebase 11.4.2。 不知何故,我错过了同步它们以使用相同的版本..

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-13
    • 2016-09-17
    • 1970-01-01
    • 2020-06-19
    相关资源
    最近更新 更多