Android的错误 - 致:java.lang.NoClassDefFoundError的:android.support.v4.util.SparseArrayCompat [英] Android error - Caused by: java.lang.NoClassDefFoundError: android.support.v4.util.SparseArrayCompat

查看:475
本文介绍了Android的错误 - 致:java.lang.NoClassDefFoundError的:android.support.v4.util.SparseArrayCompat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

启动我的应用程序,当我有这些日志错误:

I have these log errors when launching my app:

> 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

和问题只出现在安装的Andr​​oid SDK工具修订22,Android SDK中内建的工具和更新谷歌播放服务后。

And the problem appeared just after installing Android SDK Tools Rev. 22, Android SDK Build-tools and updating Google Play Services.

而在此错误

产生的原因:java.lang.NoClassDefFoundError的:android.support.v4.util.SparseArrayCompat

Caused by: java.lang.NoClassDefFoundError: android.support.v4.util.SparseArrayCompat

和指出,对于所有的android.support.v4进口的Javadoc不可访问

and noting that for all "android.support.v4" import, the Javadoc isn't accessible

注:这个元素既没有附带的源,也没有附加的Javadoc,因此没有Javadoc中可以发现

Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found.

这个问题很可能是由于Android的支持库。

the problem is probably due to the Android support library.

希望所有这些信息将帮助你找到一个解决方案。

Hope all this information will help you find a solution.

推荐答案

右键点击你的项目 - >构建路径 - >配置构建路径 - >订单和出口标签

Right Click on your project -> Build Path -> Configure Build Path -> Order and Export Tab.

确认说:Android的私人图书馆被选中用于出口。

Make sure that "Android Private Libraries" is checked for Export.

如果你从库/文件夹中添加任何库,因为他们的Android的私人图书馆一节中会自动添加删除它们。

If you've added any libraries from the libs/ folder, remove them as they are automatically added in the "Android Private Libraries" section.

这篇关于Android的错误 - 致:java.lang.NoClassDefFoundError的:android.support.v4.util.SparseArrayCompat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆