2

The signed apk of my app runs on the android versions higher than 5.0.1 but I am facing this issue that my app crashes immediately after launching the app on version 5.0.1 and this is the error I get - Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.util.ArrayMap" on path: DexPathList[[zip file "/data/app/com.*****1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

please note that the app is not crashing when I run using android studio but it crashes when I run the signed apk. I don't know what to do, I have gone through a lot of stackoverflow questions but found nothing that can solve my issue. This is my app.gradle file -

**buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' } // for crashlytics
    }
    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
    compileSdkVersion 26
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "*****"
        minSdkVersion 21
        targetSdkVersion 26
        flavorDimensions "default"
        packagingOptions {
            exclude 'META-INF/rxjava.properties'
        }
        versionCode 3
        multiDexEnabled true
        versionName "1.0.3"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    android {
        lintOptions {
            checkReleaseBuilds false
            abortOnError false
        }
    }
    compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
    }
    dexOptions {
        javaMaxHeapSize "2g"
    }
}
repositories {
    mavenCentral()
    google()
    maven { url 'https://maven.fabric.io/public' }
}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    //google 's library
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:26.0.2'
    implementation 'com.android.support:design:26.0.2'
    implementation 'com.android.support:support-v4:26.0.2'
    implementation 'com.android.support:support-v13:26.0.2'
    implementation 'com.android.support:cardview-v7:26.0.2'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    implementation 'com.google.android.gms:play-services-vision:11.8.0'

    //for barcode generation
    implementation 'com.google.zxing:core:3.2.0'
    implementation 'com.android.support:multidex:1.0.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    compile 'me.dm7.barcodescanner:zxing:1.9'
    compile 'com.journeyapps:zxing-android-embedded:3.0.2@aar'

    //multidex support
    compile 'com.android.support:multidex:1.0.1'

    //for fancy dialogs
    implementation 'com.google.android.gms:play-services-maps:11.8.0'
    implementation 'com.google.android.gms:play-services:11.8.0'
    compile 'com.geniusforapp.fancydialog:FancyDialog:0.1.4'

    //for home screen carousal view
    compile 'com.synnapps:carouselview:0.1.4'

    //for bottom navigation
    compile 'com.ss.bottomnavigation:bottomnavigation:1.5.2'

    //for shaping the image view
    compile 'com.github.siyamed:android-shape-imageview:0.9.+@aar'
    compile 'com.jackandphantom.android:circularimageview:1.2.0'

    //libraries for retrofit and conversion factory GSON
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation 'com.google.code.gson:gson:2.8.0'
    implementation 'de.hdodenhof:circleimageview:2.2.0'

    //FilePicker Library
    compile 'com.droidninja:filepicker:2.0.8'

    //for welcome screen
    compile 'com.stephentuso:welcome:1.4.1'
    compile 'com.squareup.okhttp3:okhttp:3.9.1'
    compile 'com.squareup.okhttp3:okhttp-urlconnection:3.0.1'
    compile 'com.squareup.retrofit2:converter-scalars:2.3.0'
    compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
    compile 'com.squareup.okhttp3:okhttp:3.3.1'

    //material calender picker
    compile 'com.wdullaer:materialdatetimepicker:3.4.0'


    implementation 'com.trello:rxlifecycle:1.0'
    implementation 'com.trello:rxlifecycle-components:1.0'
    compile 'com.polidea.rxandroidble:rxandroidble:1.4.3'
    implementation 'com.android.support:design:26.0.2'
    compile 'io.reactivex.rxjava2:rxjava:2.0.7'

    compile 'io.reactivex.rxjava2:rxandroid:2.0.1'

    //libraries for firebase integration
    //for analytics
    compile 'com.google.firebase:firebase-core:11.8.0'

    //for cloud messenging
    compile 'com.google.firebase:firebase-messaging:11.8.0'

    //for circular indicator
    compile 'com.github.lzyzsd:circleprogress:1.2.1'
    compile 'me.biubiubiu.justifytext:library:1.1'
    implementation files('libs/imagecapture.jar')
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
}
apply plugin: 'com.google.gms.google-services'**

This is my build.gradle (project level)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()

        maven {
            url 'https://maven.fabric.io/public'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
        classpath 'com.google.gms:google-services:3.1.0'
        classpath 'io.fabric.tools:gradle:1.25.4'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        google()
        maven { url "https://jitpack.io"

        }

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Gratien Asimbahwe
  • 1,606
  • 4
  • 19
  • 30
Anurag
  • 41
  • 5

2 Answers2

2

If the gradle version is 3.x.x try to add maven { url 'https://maven.google.com' } to

allprojects {
    repositories {
        //add here
    }
}

instead of google() and sync gradle. It should help. You can see difference between them using this link.

Muhammadjon
  • 1,476
  • 2
  • 14
  • 35
0

I found the solution. I tried building the Signed apk for both the signature versions V1(jar signature) and V2(full apk signature) and it worked.

Anurag
  • 41
  • 5