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

元气小坏坏 提交于 2019-12-11 10:24:48

问题


My project is built fine with debug build variant, but with release variant Android Studio throws:

Caused by: java.lang.ArrayIndexOutOfBoundsException: 213

What could be the issue?

If I set minifyEnabled false in build gradle for release build variant then it is being built ok, but it's not good

Update

I tried to add to proguard-rules.pro -keepnames class com.google.android.gms.** {*;}

And it builds but I don't like this solution, I don't want to keep everything of that com.google.android.gms...

Any good solution?

p.s. I use classpath 'com.google.gms:google-services:4.2.0' it root build.gradle as a dependency

Update 2

Now it started to throw Execution failed for task ':app:transformClassesWithDexBuilderForRelease'.

Multi Dex library is used of course (I'm targeting Android API 14+)


回答1:


I solved it by updating to Android Studio 3.4 RC 2 which uses R8 by default instead of Proguard

Now build variant with minifyEnabled true works fine

Seems R8 can be used with Stable AS 3.3 too but it needs some configuration: https://android-developers.googleblog.com/2018/11/r8-new-code-shrinker-from-google-is.html



来源:https://stackoverflow.com/questions/55329060/android-build-release-failed-with-caused-by-java-lang-arrayindexoutofboundsexce

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!