使用WebView时HoloEverywhere CLassNotFoundException

时间:2012-09-26 16:30:45

标签: android android-webview actionbarsherlock android-holo-everywhere

在我的项目中,我已经包含了ActionbarSherlock和HoloEverywhere。我在扩展SActivity的类中使用WebView,并发生以下错误。对这可能是什么问题有任何想法?

09-26 11:06:01.508: E/ActivityThread(16109): Failed to inflate
09-26 11:06:01.508: E/ActivityThread(16109): android.view.InflateException: Binary XML file line #2: Error inflating class WebView
09-26 11:06:01.508: E/ActivityThread(16109):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691)
09-26 11:06:01.508: E/ActivityThread(16109):    at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
09-26 11:06:01.508: E/ActivityThread(16109):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
09-26 11:06:01.508: E/ActivityThread(16109):    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
09-26 11:06:01.508: E/ActivityThread(16109):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
09-26 11:06:01.508: E/ActivityThread(16109):    at com.actionbarsherlock.internal.ActionBarSherlockNative.setContentView(ActionBarSherlockNative.java:119)
09-26 11:06:01.508: E/ActivityThread(16109):    at com.WazaBe.HoloEverywhere.sherlock.SActivity.setContentView(SActivity.java:225)
09-26 11:06:01.508: E/ActivityThread(16109):    at com.mccrajsui.MeetingRoomActivity.onCreate(MeetingRoomActivity.java:122)
09-26 11:06:01.508: E/ActivityThread(16109):    at android.app.Activity.performCreate(Activity.java:4465)
09-26 11:06:01.508: E/ActivityThread(16109):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
09-26 11:06:01.508: E/ActivityThread(16109):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2033)
09-26 11:06:01.508: E/ActivityThread(16109):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104)
09-26 11:06:01.508: E/ActivityThread(16109):    at android.app.ActivityThread.access$600(ActivityThread.java:132)
09-26 11:06:01.508: E/ActivityThread(16109):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1157)
09-26 11:06:01.508: E/ActivityThread(16109):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-26 11:06:01.508: E/ActivityThread(16109):    at android.os.Looper.loop(Looper.java:137)
09-26 11:06:01.508: E/ActivityThread(16109):    at android.app.ActivityThread.main(ActivityThread.java:4575)
09-26 11:06:01.508: E/ActivityThread(16109):    at java.lang.reflect.Method.invokeNative(Native Method)
09-26 11:06:01.508: E/ActivityThread(16109):    at java.lang.reflect.Method.invoke(Method.java:511)
09-26 11:06:01.508: E/ActivityThread(16109):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
09-26 11:06:01.508: E/ActivityThread(16109):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
09-26 11:06:01.508: E/ActivityThread(16109):    at dalvik.system.NativeStart.main(Native Method)
09-26 11:06:01.508: E/ActivityThread(16109): Caused by: java.lang.ClassNotFoundException: android.view.WebView
09-26 11:06:01.508: E/ActivityThread(16109):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
09-26 11:06:01.508: E/ActivityThread(16109):    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
09-26 11:06:01.508: E/ActivityThread(16109):    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
09-26 11:06:01.508: E/ActivityThread(16109):    at android.view.LayoutInflater.createView(LayoutInflater.java:552)
09-26 11:06:01.508: E/ActivityThread(16109):    at com.WazaBe.HoloEverywhere.LayoutInflater.onCreateView(LayoutInflater.java:141)
09-26 11:06:01.508: E/ActivityThread(16109):    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
09-26 11:06:01.508: E/ActivityThread(16109):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
09-26 11:06:01.508: E/ActivityThread(16109):    ... 21 more

布局只是一个WebView:

<?xml version="1.0" encoding="utf-8"?>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/my_webview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:scrollbarStyle="insideOverlay" />

1 个答案:

答案 0 :(得分:2)

好吧,我自己找到了解决方案。只需将HoloEverywhere Addon Preferences库添加到projekt依赖项中。