首页上一页 1 下一页尾页 2 条记录 1/1页
为什么我的Fragment运行失败...
发表在Android视频课程答疑
2020-06-27 悬赏:2 学分
是否精华
是
否
版块置顶:
是
否
为什么我的Fragment运行失败了提示 错误Fragmenting类Fragment( Error inflating class fragment)
--------- beginning of crash 2020-06-27 17:30:01.009 2425-2425/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.fragmentLearn, PID: 2425 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.fragmentLearn/com.example.fragmentLearn.MainActivity}: android.view.InflateException: Binary XML file line #11 in com.example.fragmentLearn:layout/activity_main: Binary XML file line #11 in com.example.fragmentLearn:layout/activity_main: Error inflating class fragment at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3270) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7356) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) Caused by: android.view.InflateException: Binary XML file line #11 in com.example.fragmentLearn:layout/activity_main: Binary XML file line #11 in com.example.fragmentLearn:layout/activity_main: Error inflating class fragment Caused by: android.view.InflateException: Binary XML file line #11 in com.example.fragmentLearn:layout/activity_main: Error inflating class fragment Caused by: android.app.Fragment$InstantiationException: Trying to instantiate a class com.example.fragmentLearn.BaseFragment that is not a Fragment at android.app.Fragment.instantiate(Fragment.java:538) at android.app.FragmentContainer.instantiate(FragmentContainer.java:53) at android.app.FragmentManagerImpl.onCreateView(FragmentManager.java:3553) at android.app.FragmentController.onCreateView(FragmentController.java:104) at android.app.Activity.onCreateView(Activity.java:6967) at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1069) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:997) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1123) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084) at android.view.LayoutInflater.inflate(LayoutInflater.java:682) at android.view.LayoutInflater.inflate(LayoutInflater.java:534) at android.view.LayoutInflater.inflate(LayoutInflater.java:481) at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:438) at android.app.Activity.setContentView(Activity.java:3331) at com.example.fragmentLearn.MainActivity.onCreate(MainActivity.java:13) at android.app.Activity.performCreate(Activity.java:7825) at android.app.Activity.performCreate(Activity.java:7814) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1306) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7356) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) 2020-06-27 17:30:01.009 2425-2425/? E/AndroidRuntime: Caused by: java.lang.ClassCastException ... 31 more