How to Solve the Proguard Problem – ArrayIndexOutOfBoundsException?
I’m trying to generate an APK for my app. But after the build, the compiler throws one
java.lang.ArrayIndexOutOfBoundsException
。
I know what this error means programmatically. But if I disable minifyEnabled
to False. Then the APK is generated and the app works fine.
I saw a similar question here & tried desugaring to false.
But it still throws Process ‘command 'C:\Program Files\Android\Android Studio\jre\bin\java.exe'' finished with non-zero exit value 1
How do I fix this?
Solution
My workaround is to add the following to my proguard-rules.pro
file:
-keepnames class com.google.android.gms.** {*; }
Something in the Google Play Services plugin caused me this error.
If this doesn’t resolve the issue for you, you can also preserve the name of anything outside of the app package by adding the following to your proguard-rules.pro
file:
-keepnames class !com.yourpackage.app.** { *; }
You can also use it to solve more problems to determine which class is causing the problem.