J. K. J. K. - 1 year ago 151
Android Question

NoClassDefFoundError: android.support.v4.util.ArrayMap

Getting this error on JellyBean:

01-11 18:26:52.030: E/AndroidRuntime(16517): FATAL EXCEPTION: main
01-11 18:26:52.030: E/AndroidRuntime(16517): java.lang.NoClassDefFoundError: android.support.v4.util.ArrayMap
01-11 18:26:52.030: E/AndroidRuntime(16517): at com.google.android.gms.common.api.GoogleApiClient$Builder.<init>(Unknown Source)
01-11 18:26:52.030: E/AndroidRuntime(16517): at com.example.services.LocationService.initGoogleApiClient(LocationService.java:82)
01-11 18:26:52.030: E/AndroidRuntime(16517): at com.example.services.LocationService.start(LocationService.java:73)

The project still uses Eclipse.

There are two questions about this problem, resolved in ways that do not help my case:

Crash with Android 4.1 with ArrayMap - I cannot change the Google code that crashes in my case

Android error - Caused by: java.lang.NoClassDefFoundError: android.support.v4.util.SparseArrayCompat - It is already ticked, but doesnt work

Answer Source

Frequently, a problem regarding a missing android.support class means that you have an older version of the affected library, one from before the class in question was added. Unfortunately, the JavaDocs do a poor job of indicating which version of the support libraries added newer classes.

If you are using Android Studio, make sure that your support- dependencies are fairly recent, and that your compileSdkVersion matches the major version number of the dependency.

If you are using Eclipse, you will have to not only download the latest libraries from the SDK Manager, but then remove the old library from your Eclipse project and add in an up-to-date copy of the library from your SDK installation.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download