使用API​​ 16使FloatingActionButton膨胀时出错

时间:2016-02-12 14:18:23

标签: java android android-studio

我正在使用API​​ 22& amp; 23。 我刚用API 16测试我的应用程序,它崩溃了,控制台给我这个错误: 错误膨胀类android.support.design.widget.FloatingActionButton

我已经搜索了很多关于这个错误的内容,但我没有找到任何解决这个问题的方法。

我在我的style.xml中使用“Theme.AppCompat”(针对每个不同的主题)。我的应用程序使用SDK 23编译,minSdkVersion为16,targetSdkVersion为23。

这是我的日志

com.ddesign.foyer E/AndroidRuntime: FATAL EXCEPTION: main
                                                             java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ddesign.foyer/com.ddesign.foyer.item.ItemListActivity}: android.view.InflateException: Binary XML file line #19: Error inflating class android.support.design.widget.FloatingActionButton
                                                                 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
                                                                 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
                                                                 at android.app.ActivityThread.access$600(ActivityThread.java:130)
                                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
                                                                 at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                 at android.os.Looper.loop(Looper.java:137)
                                                                 at android.app.ActivityThread.main(ActivityThread.java:4745)
                                                                 at java.lang.reflect.Method.invokeNative(Native Method)
                                                                 at java.lang.reflect.Method.invoke(Method.java:511)
                                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
                                                                 at dalvik.system.NativeStart.main(Native Method)
                                                              Caused by: android.view.InflateException: Binary XML file line #19: Error inflating class android.support.design.widget.FloatingActionButton
                                                                 at android.view.LayoutInflater.createView(LayoutInflater.java:613)
                                                                 at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
                                                                 at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
                                                                 at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
                                                                 at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
                                                                 at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
                                                                 at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:255)
                                                                 at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
                                                                 at com.ddesign.foyer.item.ItemListActivity.onCreate(ItemListActivity.java:109)
                                                                 at android.app.Activity.performCreate(Activity.java:5008)
                                                                 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
                                                                 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
                                                                 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
                                                                 at android.app.ActivityThread.access$600(ActivityThread.java:130) 
                                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
                                                                 at android.os.Handler.dispatchMessage(Handler.java:99) 
                                                                 at android.os.Looper.loop(Looper.java:137) 
                                                                 at android.app.ActivityThread.main(ActivityThread.java:4745) 
                                                                 at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                 at java.lang.reflect.Method.invoke(Method.java:511) 
                                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
                                                                 at dalvik.system.NativeStart.main(Native Method) 
                                                              Caused by: java.lang.reflect.InvocationTargetException
                                                                 at java.lang.reflect.Constructor.constructNative(Native Method)
                                                                 at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
                                                                 at android.view.LayoutInflater.createView(LayoutInflater.java:587)
                                                                 at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687) 
                                                                 at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 
                                                                 at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
                                                                 at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
                                                                 at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
                                                                 at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:255) 
                                                                 at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109) 
                                                                 at com.ddesign.foyer.item.ItemListActivity.onCreate(ItemListActivity.java:109) 
                                                                 at android.app.Activity.performCreate(Activity.java:5008) 
                                                                 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 
                                                                 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) 
                                                                 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
                                                                 at android.app.ActivityThread.access$600(ActivityThread.java:130) 
                                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
                                                                 at android.os.Handler.dispatchMessage(Handler.java:99) 
                                                                 at android.os.Looper.loop(Looper.java:137) 
                                                                 at android.app.ActivityThread.main(ActivityThread.java:4745) 
                                                                 at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                 at java.lang.reflect.Method.invoke(Method.java:511) 
                                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
                                                                 at dalvik.system.NativeStart.main(Native Method) 
                                                              Caused by: android.content.res.Resources$NotFoundException: File res/drawable/cart.xml from drawable resource ID #0x7f02003f
                                                                 at android.content.res.Resources.loadDrawable(Resources.java:1923)
                                                                 at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
                                                                 at android.widget.ImageView.<init>(ImageView.java:120)
                                                                 at android.support.design.widget.FloatingActionButton.<init>(FloatingActionButton.java:83)
                                                                 at android.support.design.widget.FloatingActionButton.<init>(FloatingActionButton.java:79)
                                                                 at java.lang.reflect.Constructor.constructNative(Native Method) 
                                                                 at java.lang.reflect.Constructor.newInstance(Constructor.java:417) 
                                                                 at android.view.LayoutInflater.createView(LayoutInflater.java:587) 
                                                                 at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687) 
                                                                 at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 
                                                                 at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
                                                                 at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
                                                                 at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
                                                                 at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:255) 
                                                                 at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109) 
                                                                 at com.ddesign.foyer.item.ItemListActivity.onCreate(ItemListActivity.java:109) 
                                                                 at android.app.Activity.performCreate(Activity.java:5008) 
                                                                 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 
                                                                 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) 
                                                                 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
                                                                 at android.app.ActivityThread.access$600(ActivityThread.java:130) 
                                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
                                                                 at android.os.Handler.dispatchMessage(Handler.java:99) 
                                                                 at android.os.Looper.loop(Looper.java:137) 
                                                                 at android.app.ActivityThread.main(ActivityThread.java:4745) 
                                                                 at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                 at java.lang.reflect.Method.invoke(Method.java:511) 
                                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
                                                                 at dalvik.system.NativeStart.main(Native Method) 
                                                              Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #2: invalid drawable tag vector
                                                                 at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:877)
                                                                 at android.graphics.drawable.Drawable.createFromXml(Drawable.java:818)
                                                                 at android.content.res.Resources.loadDrawable(Resources.java:1920)
                                                                 at android.content.res.TypedArray.getDrawable(TypedArray.java:601) 
                                                                 at android.widget.ImageView.<init>(ImageView.java:120) 
                                                                 at android.support.design.widget.FloatingActionButton.<init>(FloatingActionButton.java:83) 
                                                                 at android.support.design.widget.FloatingActionButton.<init>(FloatingActionButton.java:79) 
                                                                 at java.lang.reflect.Constructor.constructNative(Native Method) 
                                                                 at java.lang.reflect.Constructor.newInstance(Constructor.java:417) 
                                                                 at android.view.LayoutInflater.createView(LayoutInflater.java:587) 
                                                                 at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687) 
                                                                 at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 
                                                                 at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
                                                                 at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
                                                                 at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
                                                                 at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:255) 
                                                                 at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109) 
                                                                 at com.ddesign.foyer.item.ItemListActivity.onCreate(ItemListActivity.java:109) 
                                                                 at android.app.Activity.performCreate(Activity.java:5008) 
                                                                 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 
                                                                 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) 
                                                                 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
                                                                 at android.app.ActivityThread.access$600(ActivityThread.java:130) 
                                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
                                                                 at android.os.Handler.dispatchMessage(Handler.java:99) 
                                                                 at android.os.Looper.loop(Looper.java:137) 
                                                                 at android.app.ActivityThread.main(ActivityThread.java:4745) 
                                                                 at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                 at java.lang.reflect.Method.invoke(Method.java:511) 
                                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
                                                                 at dalvik.system.NativeStart.main(Native Method) 

我希望你能帮我解决这个错误。 谢谢你读我(还有我的坏英语^^)。

编辑:

(cart.xml)

0 个答案:

没有答案