Reputation: 308
The issue is very simple to explain, I'm getting error
Exception while processing task java.io.IOException: java.lang.ArrayIndexOutOfBoundsException: 4
while building APK. At first, I didn't enable minify and it worked (but produced NoClassFoundError). That's why I enabled the minify in the build.gradle file. Initially, I got a lot of warnings from pro guard, So I ignored all of them using -dontwarn
.
After ignoring all warnings I got the above-mentioned exception. I don't know what went wrong. Here I've attached both gradle file and pro guard content.
build.gradle
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.plumelabs.air"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
debug{
//multiDexKeepProguard file('multidex-config.pro')
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
release {
multiDexKeepProguard file('multidex-config.pro')
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso- core:3.0.2'
implementation 'com.android.support:multidex:1.0.0'
implementation 'com.google.android.gms:play-services-auth:16.0.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-places:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
// https://mvnrepository.com/artifact/com.github.doctoror.geocoder/library
implementation group: 'com.github.doctoror.geocoder', name: 'library', version: '1.3.0'
implementation group: 'io.fabric.sdk.android', name: 'fabric', version: '1.4.2'
implementation 'io.nlopez.smartlocation:library:3.3.3'
implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
implementation 'com.facebook.android:facebook-core:[4,5)'
implementation 'com.facebook.android:facebook-login:[4,5)'
/*implementation 'com.facebook.android:facebook-share:[4,5)'
implementation 'com.facebook.android:facebook-places:[4,5)'
implementation 'com.facebook.android:facebook-messenger:[4,5)'
implementation 'com.facebook.android:facebook-applinks:[4,5)'*/
implementation 'com.google.firebase:firebase-core:16.0.6'
// implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-dynamic-links:16.1.5'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.code.gson:gson:2.8.4'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.github.bumptech.glide:glide:3.7.0'
annotationProcessor 'com.github.bumptech.glide:glide:3.7.0'
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation 'com.github.hotchemi:android-rate:1.0.1'
implementation 'com.romandanylyk:pageindicatorview:1.0.2'
implementation 'com.karumi:dexter:5.0.0'
implementation 'com.getkeepsafe.taptargetview:taptargetview:1.12.0'
implementation group: 'com.squareup.okhttp3', name: 'logging-interceptor', version: '3.10.0'
}
Pro guard Content
-keep class com.** { *; }
-dontwarn com.**
-dontwarn retrofit2.**
#-dontwarn okhttp3.**
-dontwarn okio.**
-keepattributes Signature
-keepattributes Annotation
-keep class okhttp3.* { *; }
-keep interface okhttp3.* { *; }
-dontwarn okhttp3.
-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn com.squareup.okhttp3.**
-keep class com.squareup.okhttp3.** { *; }
-keep interface com.squareup.okhttp3.* { *; }
-dontwarn javax.annotation.Nullable
-dontwarn javax.annotation.ParametersAreNonnullByDefault
-dontwarn org.**
Upvotes: 0
Views: 275
Reputation: 5724
Using -dontwarn
with org.**
domain is awfu that ignores a wide range of errors that you should avoid using it!
You just add proguard rules that some libraries recommend us.
but this error means that some classes in obfuscation
has been changed that you should find which classes have this condition. and after that just keeping these by adding below rule:
-keep class packagename.* { *; }
Upvotes: 1