导致“android.view.ViewInflate$InflateException: Binary xml file”的可能原因是什么?以下是所有错误。我不知道为什么,每次我创建一些关于 Fragments 的项目时,它都会提示这些错误。
09-21 22:57:09.166: E/AndroidRuntime(674): FATAL EXCEPTION: main
09-21 22:57:09.166: E/AndroidRuntime(674): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.testfra/com.example.testfra.FragTestActivity}: android.view.InflateException: Binary XML file line #8: Error inflating class Fragment
09-21 22:57:09.166: E/AndroidRuntime(674): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
09-21 22:57:09.166: E/AndroidRuntime(674): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
09-21 22:57:09.166: E/AndroidRuntime(674): at android.app.ActivityThread.access$600(ActivityThread.java:123)
09-21 22:57:09.166: E/AndroidRuntime(674): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
09-21 22:57:09.166: E/AndroidRuntime(674): at android.os.Handler.dispatchMessage(Handler.java:99)
09-21 22:57:09.166: E/AndroidRuntime(674): at android.os.Looper.loop(Looper.java:137)
09-21 22:57:09.166: E/AndroidRuntime(674): at android.app.ActivityThread.main(ActivityThread.java:4424)
09-21 22:57:09.166: E/AndroidRuntime(674): at java.lang.reflect.Method.invokeNative(Native Method)
09-21 22:57:09.166: E/AndroidRuntime(674): at java.lang.reflect.Method.invoke(Method.java:511)
09-21 22:57:09.166: E/AndroidRuntime(674): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
09-21 22:57:09.166: E/AndroidRuntime(674): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
09-21 22:57:09.166: E/AndroidRuntime(674): at dalvik.system.NativeStart.main(Native Method)
09-21 22:57:09.166: E/AndroidRuntime(674): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class Fragment
09-21 22:57:09.166: E/AndroidRuntime(674): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691)
09-21 22:57:09.166: E/AndroidRuntime(674): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
09-21 22:57:09.166: E/AndroidRuntime(674): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
09-21 22:57:09.166: E/AndroidRuntime(674): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
09-21 22:57:09.166: E/AndroidRuntime(674): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
09-21 22:57:09.166: E/AndroidRuntime(674): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
09-21 22:57:09.166: E/AndroidRuntime(674): at android.app.Activity.setContentView(Activity.java:1835)
09-21 22:57:09.166: E/AndroidRuntime(674): at com.example.testfra.FragTestActivity.onCreate(FragTestActivity.java:12)
09-21 22:57:09.166: E/AndroidRuntime(674): at android.app.Activity.performCreate(Activity.java:4465)
09-21 22:57:09.166: E/AndroidRuntime(674): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
09-21 22:57:09.166: E/AndroidRuntime(674): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
09-21 22:57:09.166: E/AndroidRuntime(674): ... 11 more
09-21 22:57:09.166: E/AndroidRuntime(674): Caused by: java.lang.ClassNotFoundException: android.view.Fragment
09-21 22:57:09.166: E/AndroidRuntime(674): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
09-21 22:57:09.166: E/AndroidRuntime(674): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
09-21 22:57:09.166: E/AndroidRuntime(674): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
09-21 22:57:09.166: E/AndroidRuntime(674): at android.view.LayoutInflater.createView(LayoutInflater.java:552)
09-21 22:57:09.166: E/AndroidRuntime(674): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:636)
09-21 22:57:09.166: E/AndroidRuntime(674): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
09-21 22:57:09.166: E/AndroidRuntime(674): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
09-21 22:57:09.166: E/AndroidRuntime(674): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
09-21 22:57:09.166: E/AndroidRuntime(674): ... 21 more