【问题标题】:Android build release failed with Caused by: java.lang.ArrayIndexOutOfBoundsException: 213 (proguard issue)Android 构建发布失败,原因是:java.lang.ArrayIndexOutOfBoundsException: 213(pr​​oguard 问题)
【发布时间】:2019-03-24 22:07:40
【问题描述】:

我的项目使用调试构建变体构建良好,但 Android Studio 会抛出发布变体:

原因:java.lang.ArrayIndexOutOfBoundsException: 213

可能是什么问题?

如果我在 build gradle 中设置 minifyEnabled false 用于发布 build 变体,那么它正在构建中,但它并不好

更新

我尝试添加到proguard-rules.pro -keepnames class com.google.android.gms.** {*;}

它可以构建,但我不喜欢这个解决方案,我不想保留 com.google.android.gms 的所有内容...

有什么好的解决办法吗?

附言我使用 classpath 'com.google.gms:google-services:4.2.0' 它根 build.gradle 作为依赖项

更新 2

现在开始抛出Execution failed for task ':app:transformClassesWithDexBuilderForRelease'.

当然使用了 Multi Dex 库(我的目标是 Android API 14+)

【问题讨论】:

    标签: android android-studio android-gradle-plugin build.gradle


    【解决方案1】:

    我通过更新到默认使用 R8 而不是 Proguard

    的 Android Studio 3.4 RC 2 解决了这个问题

    现在使用minifyEnabled true 构建变体可以正常工作

    似乎 R8 也可以与 Stable AS 3.3 一起使用,但需要一些配置:https://android-developers.googleblog.com/2018/11/r8-new-code-shrinker-from-google-is.html

    【讨论】:

      猜你喜欢
      • 2011-01-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-30
      • 1970-01-01
      • 2020-03-21
      • 2011-07-16
      • 2014-11-18
      相关资源
      最近更新 更多