1

I am working on an application. It works perfectly on a device with android 5.0. But crashes constantly on lower versions. Have so far tried it out on 4.4.4, 4.4.2.

I get the following error.

java.lang.NoClassDefFoundError: android.support.v4.util.ContainerHelpers
    at android.support.v4.util.SimpleArrayMap.<init>(SimpleArrayMap.java:209)
    at android.support.v4.app.FragmentActivity.getLoaderManager(FragmentActivity.java:867)
    at android.support.v4.app.FragmentActivity.getSupportLoaderManager(FragmentActivity.java:861)
    at com.client.login.LoginActivity.populateAutoComplete(LoginActivity.java:164)
    at com.client.login.LoginActivity.setupView(LoginActivity.java:126)
    at com.client.login.LoginActivity.onCreate(LoginActivity.java:71)

I am using android studio for development. My build.gradle is as follows

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion '22.0.1'
    defaultConfig {
        applicationId 'com.client'
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        multiDexEnabled = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug{

        }
    }
    productFlavors {
    }

    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/services/com.fasterxml.jackson.databind.Module'
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:support-v4:22.1.1'
    compile 'com.android.support:appcompat-v7:22.1.1'
    //compile 'com.facebook.android:facebook-android-sdk:3.21.1'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.5.0'
    compile 'com.fasterxml.jackson.core:jackson-core:2.5.0'
    compile 'com.fasterxml.jackson.core:jackson-annotations:2.5.0'
    compile 'com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.5.0'
    compile 'joda-time:joda-time:2.0'
    compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.5.0'
    compile 'com.google.guava:guava:18.0'
    compile 'com.google.android.gms:play-services:7.3.0'
    compile 'com.google.code.gson:gson:2.3.1'
    compile 'com.loopj.android:android-async-http:1.4.6'
    compile 'com.etsy.android.grid:library:1.0.5'
}

Thanks a lot.

  • Did you configure proguard? (see for instance http://stackoverflow.com/questions/6560244/proguard-error-when-exporting-signed-app-using-android-support-v4-app-honeycomb) – Trinimon May 03 '15 at 14:38

1 Answers1

1

Found the solution on this post

java.lang.NoClassDefFoundError: android.support.v4.app.NavUtilsJB error when adding new module in Android Studio

Problem was due to multi dexing being added in lollipop. Had to add the multidex support library to my gradle for previous android versions.

Community
  • 1
  • 1