Android error - caused by: java.lang.NoClassDefFoundError: android.support.v4.util.SparseArrayCompat

I have these log errors when running my application:

> 05-20 01:48:35.312: E/AndroidRuntime(23032): FATAL EXCEPTION: main 05-20 01:48:35.312: E/AndroidRuntime(23032): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tomsyweb.suna/com.tomsyweb.suna.MainActivity}: android.view.InflateException: Binary XML file line #9: Error inflating class com.origamilabs.library.views.StaggeredGridView 05-20 01:48:35.312: E/AndroidRuntime(23032): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651) 05-20 01:48:35.312: E/AndroidRuntime(23032): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667) 05-20 01:48:35.312: E/AndroidRuntime(23032): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 05-20 01:48:35.312: E/AndroidRuntime(23032): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935) 05-20 01:48:35.312: E/AndroidRuntime(23032): at android.os.Handler.dispatchMessage(Handler.java:99) 05-20 01:48:35.312: E/AndroidRuntime(23032): at android.os.Looper.loop(Looper.java:130) 05-20 01:48:35.312: E/AndroidRuntime(23032): at android.app.ActivityThread.main(ActivityThread.java:3687) 05-20 01:48:35.312: E/AndroidRuntime(23032): at java.lang.reflect.Method.invokeNative(Native Method) 05-20 01:48:35.312: E/AndroidRuntime(23032): at java.lang.reflect.Method.invoke(Method.java:507) 05-20 01:48:35.312: E/AndroidRuntime(23032): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) 05-20 01:48:35.312: E/AndroidRuntime(23032): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625) 05-20 01:48:35.312: E/AndroidRuntime(23032): at dalvik.system.NativeStart.main(Native Method) 05-20 01:48:35.312: E/AndroidRuntime(23032): Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class com.origamilabs.library.views.StaggeredGridView 05-20 01:48:35.312: E/AndroidRuntime(23032): at android.view.LayoutInflater.createView(LayoutInflater.java:518) 05-20 01:48:35.312: E/AndroidRuntime(23032): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570) 05-20 01:48:35.312: E/AndroidRuntime(23032): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623) 05-20 01:48:35.312: E/AndroidRuntime(23032): at android.view.LayoutInflater.inflate(LayoutInflater.java:408) 05-20 01:48:35.312: E/AndroidRuntime(23032): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 05-20 01:48:35.312: E/AndroidRuntime(23032): at android.view.LayoutInflater.inflate(LayoutInflater.java:276) 05-20 01:48:35.312: E/AndroidRuntime(23032): at com.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:853) 05-20 01:48:35.312: E/AndroidRuntime(23032): at com.actionbarsherlock.app.SherlockActivity.setContentView(SherlockActivity.java:229) 05-20 01:48:35.312: E/AndroidRuntime(23032): at com.tomsyweb.suna.MainActivity.onCreate(MainActivity.java:72) 05-20 01:48:35.312: E/AndroidRuntime(23032): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 05-20 01:48:35.312: E/AndroidRuntime(23032): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615) 05-20 01:48:35.312: E/AndroidRuntime(23032): ... 11 more 05-20 01:48:35.312: E/AndroidRuntime(23032): Caused by: java.lang.reflect.InvocationTargetException 05-20 01:48:35.312: E/AndroidRuntime(23032): at java.lang.reflect.Constructor.constructNative(Native Method) 05-20 01:48:35.312: E/AndroidRuntime(23032): at java.lang.reflect.Constructor.newInstance(Constructor.java:415) 05-20 01:48:35.312: E/AndroidRuntime(23032): at android.view.LayoutInflater.createView(LayoutInflater.java:505) 05-20 01:48:35.312: E/AndroidRuntime(23032): ... 21 more 05-20 01:48:35.312: E/AndroidRuntime(23032): Caused by: java.lang.NoClassDefFoundError: android.support.v4.util.SparseArrayCompat 05-20 01:48:35.312: E/AndroidRuntime(23032): at com.origamilabs.library.views.StaggeredGridView.<init>(StaggeredGridView.java:297) 05-20 01:48:35.312: E/AndroidRuntime(23032): at com.origamilabs.library.views.StaggeredGridView.<init>(StaggeredGridView.java:304) 05-20 01:48:35.312: E/AndroidRuntime(23032): ... 24 more 

And the problem arose immediately after installing Android SDK Tools Rev. 22, Android SDK Build-tools and updates to Google Play services.

While with this error

Called: java.lang.NoClassDefFoundError: android.support.v4.util.SparseArrayCompat

and noting that Javadoc is not available for all imports of "android.support.v4"

Note. This element did not connect the source or add Javadoc, and therefore, Javadoc was not found.

the problem is probably related to the android support library.

We hope that all this information will help you find a solution.

+11
android android-support-library
May 20 '13 at 2:33
source share
5 answers

Right-click on your project → Build Path → Configure Build Path → Order and Export Tab.

Make sure that “Private Android libraries” are checked for “Export”.

If you added any libraries from the libs / folder, delete them, because they are automatically added to the "Private Android libraries" section.

+39
May 20 '13 at 2:41
source share

I always get this and just restart eclipse to enable it on the MAC laptop.

+1
Oct 27 '14 at 16:05
source share

right click on the project - properties - java build path - order and export - mark the personal Android libraries and all the libraries that added

0
Oct 18 '13 at 12:05
source share

Solutions:

  • List item
  • Check Export Order
  • Enable Multi Dex
  • Check the level of api views in the layout. I ran into the same issue with searchView. I have an api level check when adding searchview, but the implementation of SearchView.OnQueryTextListener is added to the class file.
  • Check library support v4, v7, etc.
0
Oct. 15 '16 at 9:30
source share

As long as your compilation version does not match your minimum required version of the SDK, the android will create appcompat, the created appcompat can reference its own support-v4 , and the version of support-v4 may be different from the support-v7 you have, even if you have a compatible one support-v4 . I solved this problem only so that the Minimum Required SDK version is the same with the compilation version. I wish to help everyone.

-one
Jan 26 '16 at 8:23
source share



All Articles