Android错误膨胀类com.actionbarsherlock.internal.widget.ActionBarContainer

时间:2013-04-05 18:59:45

标签: android actionbarsherlock inflate

最近我在我的android项目中添加了ActionBarSherlock。在AVD版本4.1上添加并测试应用程序之后,一切都很好,但是在2.3.3启动应用程序时,在setContentView上启动活动时会出现下一类错误:

> 04-05 18:55:03.277: E/AndroidRuntime(659): FATAL EXCEPTION: main
04-05 18:55:03.277: E/AndroidRuntime(659): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.fitness.calculator/com.fitness.calculator.ProportionsActivity}: android.view.InflateException: Binary XML file line #26: Error inflating class com.actionbarsherlock.internal.widget.ActionBarContainer
04-05 18:55:03.277: E/AndroidRuntime(659):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
04-05 18:55:03.277: E/AndroidRuntime(659):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
04-05 18:55:03.277: E/AndroidRuntime(659):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-05 18:55:03.277: E/AndroidRuntime(659):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
04-05 18:55:03.277: E/AndroidRuntime(659):  at android.os.Handler.dispatchMessage(Handler.java:99)
04-05 18:55:03.277: E/AndroidRuntime(659):  at android.os.Looper.loop(Looper.java:123)
04-05 18:55:03.277: E/AndroidRuntime(659):  at android.app.ActivityThread.main(ActivityThread.java:3683)
04-05 18:55:03.277: E/AndroidRuntime(659):  at java.lang.reflect.Method.invokeNative(Native Method)
04-05 18:55:03.277: E/AndroidRuntime(659):  at java.lang.reflect.Method.invoke(Method.java:507)
04-05 18:55:03.277: E/AndroidRuntime(659):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-05 18:55:03.277: E/AndroidRuntime(659):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-05 18:55:03.277: E/AndroidRuntime(659):  at dalvik.system.NativeStart.main(Native Method)
04-05 18:55:03.277: E/AndroidRuntime(659): Caused by: android.view.InflateException: Binary XML file line #26: Error inflating class com.actionbarsherlock.internal.widget.ActionBarContainer
04-05 18:55:03.277: E/AndroidRuntime(659):  at android.view.LayoutInflater.createView(LayoutInflater.java:518)
04-05 18:55:03.277: E/AndroidRuntime(659):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570)
04-05 18:55:03.277: E/AndroidRuntime(659):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
04-05 18:55:03.277: E/AndroidRuntime(659):  at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
04-05 18:55:03.277: E/AndroidRuntime(659):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-05 18:55:03.277: E/AndroidRuntime(659):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-05 18:55:03.277: E/AndroidRuntime(659):  at com.actionbarsherlock.internal.ActionBarSherlockCompat.generateLayout(ActionBarSherlockCompat.java:1045)
04-05 18:55:03.277: E/AndroidRuntime(659):  at com.actionbarsherlock.internal.ActionBarSherlockCompat.installDecor(ActionBarSherlockCompat.java:915)
04-05 18:55:03.277: E/AndroidRuntime(659):  at com.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:849)
04-05 18:55:03.277: E/AndroidRuntime(659):  at com.actionbarsherlock.app.SherlockActivity.setContentView(SherlockActivity.java:229)
04-05 18:55:03.277: E/AndroidRuntime(659):  at com.fitness.calculator.MainMenuActivity.onCreate(MainMenuActivity.java:45)
04-05 18:55:03.277: E/AndroidRuntime(659):  at com.fitness.calculator.ProportionsActivity.onCreate(ProportionsActivity.java:90)
04-05 18:55:03.277: E/AndroidRuntime(659):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-05 18:55:03.277: E/AndroidRuntime(659):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
04-05 18:55:03.277: E/AndroidRuntime(659):  ... 11 more
04-05 18:55:03.277: E/AndroidRuntime(659): Caused by: java.lang.reflect.InvocationTargetException
04-05 18:55:03.277: E/AndroidRuntime(659):  at java.lang.reflect.Constructor.constructNative(Native Method)
04-05 18:55:03.277: E/AndroidRuntime(659):  at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
04-05 18:55:03.277: E/AndroidRuntime(659):  at android.view.LayoutInflater.createView(LayoutInflater.java:505)
04-05 18:55:03.277: E/AndroidRuntime(659):  ... 24 more
04-05 18:55:03.277: E/AndroidRuntime(659): Caused by: java.lang.NoSuchMethodError: com.actionbarsherlock.internal.widget.ActionBarContainer.setBackground
04-05 18:55:03.277: E/AndroidRuntime(659):  at com.actionbarsherlock.internal.widget.ActionBarContainer.<init>(ActionBarContainer.java:58)
04-05 18:55:03.277: E/AndroidRuntime(659):  ... 27 more

是否有人知道可能导致此类错误的原因是什么?有任何想法吗?我找不到解决这个问题的方法。

1 个答案:

答案 0 :(得分:0)

我通过重新添加清除ActionBarSherlock库来解决此问题。我第一次修复了库中的所有警告,导致了这个问题。因此,请勿尝试修复ActionBarSherlock中的警告。希望这会对某人有所帮助。