我正在尝试创建一个基于Google"材料设计的菜单标签"使用Eclipse,但是我收到了一个错误:
01-07 01:02:10.238: E/tag(6696): contact on create called
01-07 01:02:10.301: E/AndroidRuntime(6696): FATAL EXCEPTION: main
01-07 01:02:10.301: E/AndroidRuntime(6696): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.rvappsstudios.designflashalerts/com.rvappsstudios.designflashalerts.MainActivity}: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.rvappsstudios.designflashalerts/com.rvappsstudios.designflashalerts.Contact_mainfragment}: android.view.InflateException: Binary XML file line #8: Error inflating class android.support.design.widget.TabLayout
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2343)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.app.ActivityThread.access$600(ActivityThread.java:162)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.os.Handler.dispatchMessage(Handler.java:107)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.os.Looper.loop(Looper.java:194)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.app.ActivityThread.main(ActivityThread.java:5371)
01-07 01:02:10.301: E/AndroidRuntime(6696): at java.lang.reflect.Method.invokeNative(Native Method)
01-07 01:02:10.301: E/AndroidRuntime(6696): at java.lang.reflect.Method.invoke(Method.java:525)
01-07 01:02:10.301: E/AndroidRuntime(6696): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
01-07 01:02:10.301: E/AndroidRuntime(6696): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
01-07 01:02:10.301: E/AndroidRuntime(6696): at dalvik.system.NativeStart.main(Native Method)
01-07 01:02:10.301: E/AndroidRuntime(6696): Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.rvappsstudios.designflashalerts/com.rvappsstudios.designflashalerts.Contact_mainfragment}: android.view.InflateException: Binary XML file line #8: Error inflating class android.support.design.widget.TabLayout
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2343)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.app.ActivityThread.startActivityNow(ActivityThread.java:2186)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:135)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:347)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:749)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.widget.TabHost.setCurrentTab(TabHost.java:413)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.widget.TabHost.addTab(TabHost.java:240)
01-07 01:02:10.301: E/AndroidRuntime(6696): at com.rvappsstudios.designflashalerts.MainActivity.onCreate(MainActivity.java:41)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.app.Activity.performCreate(Activity.java:5122)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2307)
01-07 01:02:10.301: E/AndroidRuntime(6696): ... 11 more
01-07 01:02:10.301: E/AndroidRuntime(6696): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class android.support.design.widget.TabLayout
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:255)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
01-07 01:02:10.301: E/AndroidRuntime(6696): at com.rvappsstudios.designflashalerts.Contact_mainfragment.onCreate(Contact_mainfragment.java:25)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.app.Activity.performCreate(Activity.java:5122)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2307)
01-07 01:02:10.301: E/AndroidRuntime(6696): ... 21 more
01-07 01:02:10.301: E/AndroidRuntime(6696): Caused by: java.lang.reflect.InvocationTargetException
01-07 01:02:10.301: E/AndroidRuntime(6696): at java.lang.reflect.Constructor.constructNative(Native Method)
01-07 01:02:10.301: E/AndroidRuntime(6696): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
01-07 01:02:10.301: E/AndroidRuntime(6696): ... 32 more
01-07 01:02:10.301: E/AndroidRuntime(6696): Caused by: java.lang.NoClassDefFoundError: android.support.design.R$styleable
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.support.design.widget.TabLayout.<init>(TabLayout.java:234)
01-07 01:02:10.301: E/AndroidRuntime(6696): at android.support.design.widget.TabLayout.<init>(TabLayout.java:219)
01-07 01:02:10.301: E/AndroidRuntime(6696): ... 35 more
答案 0 :(得分:6)
我在我的博客上描述过它。
http://www.geeksmember.blogspot.in/2015/10/errorerror-inflating-class.html
我也回答了关于stackoverflow的类似问题。看到这个问题的答案。
Error inflating class android.support.design.widget.TabLayout