问题
I'm trying to create a menu tab based on Google's "material design" using Eclipse, but I got an error:
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
回答1:
I have described it on my blog.
http://www.geeksmember.blogspot.in/2015/10/errorerror-inflating-class.html
I also answered the similar question on stackoverflow as well. See this question's answer.
Error inflating class android.support.design.widget.TabLayout
来源:https://stackoverflow.com/questions/32732781/got-error-inflating-class-android-support-design-widget-tablayout