最近我在我的 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
有谁知道什么可能导致这种类型的错误?有任何想法吗?我找不到这个问题的解决方案。