qq_34613346
qq_34613346
2019-05-07 00:01

新建了一个安卓项目,什么代码都没改动运行后就报错,请问是什么原因呢

20
  • android-studio
  • xml
  • android

05-06 23:54:39.382 26163-26163/test.an.myapplication E/AndroidRuntime: FATAL EXCEPTION: main
Process: test.an.myapplication, PID: 26163
java.lang.RuntimeException: Unable to start activity ComponentInfo{test.an.myapplication/test.an.myapplication.MainActivity}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class android.support.v7.widget.Toolbar
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2757)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2818)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1557)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6395)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class android.support.v7.widget.Toolbar
Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class android.support.v7.widget.Toolbar
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.view.LayoutInflater.createView(LayoutInflater.java:652)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:812)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:752)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:883)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:846)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:886)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:846)
at android.view.LayoutInflater.inflate(LayoutInflater.java:522)
at android.view.LayoutInflater.inflate(LayoutInflater.java:430)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at android.support.v7.app.AppCompatDelegateImplV9.createSubDecor(AppCompatDelegateImplV9.java:406)
at android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImplV9.java:323)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at test.an.myapplication.MainActivity.onCreate(MainActivity.java:11)
at android.app.Activity.performCreate(Activity.java:6868)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2710)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2818)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1557)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6395)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 10 to dimension: type=0x1
at android.content.res.TypedArray.getDimensionPixelOffset(TypedArray.java:672)
at android.support.v7.widget.TintTypedArray.getDimensionPixelOffset(TintTypedArray.java:188)
at android.support.v7.widget.Toolbar.(Toolbar.java:293)
at android.support.v7.widget.Toolbar.(Toolbar.java:228)
at java.lang.reflect.Constructor.newInstance0(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:430) 
at android.view.LayoutInflater.createView(LayoutInflater.java:652) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:812) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:752) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:883) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:846) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:886) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:846) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:522) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:430) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:377) 
at android.support.v7.app.AppCompatDelegateImplV9.createSubDecor(AppCompatDelegateImplV9.java:406) 
at android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImplV9.java:323) 
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
at test.an.myapplication.MainActivity.onCreate(MainActivity.java:11) 
at android.app.Activity.performCreate(Activity.java:6868) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2710) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2818) 
at android.app.ActivityThread.-wrap12(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1557) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:163) 
at android.app.ActivityThread.main(ActivityThread.java:6395) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794) 
图片说明

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

5条回答