Android 构建发布失败,原因为:java.lang.ArrayIndexOutOfBoundsException:213(pr​​oguard 问题)

Android build release failed with Caused by: java.lang.ArrayIndexOutOfBoundsException: 213 (proguard issue)

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

Caused by: java.lang.ArrayIndexOutOfBoundsException: 213

可能是什么问题?

如果我在构建 gradle 中为发布构建变体设置 minifyEnabled false,那么它构建正常,但效果不佳

更新

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

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

有什么好的解决办法吗?

p.s。我使用 classpath 'com.google.gms:google-services:4.2.0' root build.gradle 作为依赖项

更新 2

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

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

我通过更新到默认使用 R8 而不是 Proguard[= 的 Android Studio 3.4 RC 2 解决了这个问题12=]

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

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