android - Android 构建发布失败,原因是:java.lang.ArrayIndexOutOfBoundsException: 213(proguard 问题)
问题描述
我的项目使用调试构建变体构建得很好,但使用发布变体 Android Studio 会抛出:
引起:java.lang.ArrayIndexOutOfBoundsException:213
可能是什么问题?
如果我minifyEnabled false
在 build gradle 中设置发布版本变体,那么它正在构建中,但它并不好
更新
我试图添加到proguard-rules.pro
-keepnames class com.google.android.gms.** {*;}
它建立了,但我不喜欢这个解决方案,我不想保留所有这些com.google.android.gms
......
有什么好的解决办法吗?
ps 我使用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 解决了这个问题
现在构建变体minifyEnabled true
工作正常
似乎R8也可以与 Stable AS 3.3 一起使用,但它需要一些配置:https ://android-developers.googleblog.com/2018/11/r8-new-code-shrinker-from-google-is.html
推荐阅读
- delphi - 列表
其中 T 是一条记录 - javascript - 基于另一个字符串/数组Javascript从1个字符串/数组中删除值
- oracle - 使用 Postgres DDL 创建的表是否会转换为 Liquibase 中的其他 DB DDL?
- c - 如何在C中制作动态结构
- performance-testing - 无法将新计算机添加到 gatling 数据库页面
- python - 将 dictionary_tree 转换为元组列表
- r - 当数据没有按性别分开时,如何单独检查性别分布?
- python - 如何获取与作者相关的点赞总数,并在达到一定数量时使用它发送通知
- arrays - 在 C 中扫描不同数量的数据
- javascript - 在 React 中选择下一个/上一个列表项而不重新渲染