每当我尝试在Kitkat中打开一个片段我的应用程序崩溃时,该应用程序在Lollipop和更高版本中工作正常

时间:2018-03-28 08:02:31

标签: android android-fragments

E/UncaughtException: android.view.InflateException: Binary XML file line #0: Error inflating class TextView
   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
   at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
   at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
   at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
   at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
   at in.saneswap.fragment.SwipeWithBuddiesFragment.onCreateView(SourceFile:93)
   at android.support.v4.app.Fragment.performCreateView(SourceFile:2354)
   at android.support.v4.app.FragmentManagerImpl.moveToState(SourceFile:1419)
   at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(SourceFile:1740)
   at android.support.v4.app.FragmentManagerImpl.moveToState(SourceFile:1809)
   at android.support.v4.app.BackStackRecord.executeOps(SourceFile:799)
   at android.support.v4.app.FragmentManagerImpl.executeOps(SourceFile:2580)
   at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(SourceFile:2367)
   at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(SourceFile:2322)
   at android.support.v4.app.FragmentManagerImpl.execPendingActions(SourceFile:2229)
   at android.support.v4.app.FragmentManagerImpl$1.run(SourceFile:700)
   at android.os.Handler.handleCallback(Handler.java:733)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:136)
   at android.app.ActivityThread.main(ActivityThread.java:5001)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:515)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
   at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/line.xml from drawable resource ID #0x7f0801d7
   at android.content.res.Resources.loadDrawable(Resources.java:2096)
   at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
   at android.widget.TextView.<init>(TextView.java:806)
   at android.support.v7.widget.AppCompatTextView.<init>(SourceFile:75)
   at android.support.v7.widget.AppCompatTextView.<init>(SourceFile:71)
   at android.support.v7.app.AppCompatViewInflater.createView(SourceFile:103)
   at android.support.v7.app.AppCompatDelegateImplV9.createView(SourceFile:1024)
   at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(SourceFile:1081)
   at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:172)
   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:684)
   at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
   at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 
   at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
   at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
   at in.saneswap.fragment.SwipeWithBuddiesFragment.onCreateView(SourceFile:93) 
   at android.support.v4.app.Fragment.performCreateView(SourceFile:2354) 
   at android.support.v4.app.FragmentManagerImpl.moveToState(SourceFile:1419) 
   at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(SourceFile:1740) 
   at android.support.v4.app.FragmentManagerImpl.moveToState(SourceFile:1809) 
   at android.support.v4.app.BackStackRecord.executeOps(SourceFile:799) 
   at android.support.v4.app.FragmentManagerImpl.executeOps(SourceFile:2580) 
   at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(SourceFile:2367) 
   at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(SourceFile:2322) 
   at android.support.v4.app.FragmentManagerImpl.execPendingActions(SourceFile:2229) 
   at android.support.v4.app.FragmentManagerImpl$1.run(SourceFile:700) 
   at android.os.Handler.handleCallback(Handler.java:733) 
   at android.os.Handler.dispatchMessage(Handler.java:95) 
   at android.os.Looper.loop(Looper.java:136) 
   at android.app.ActivityThread.main(ActivityThread.java:5001) 
   at java.lang.reflect.Method.invokeNative(Native Method) 
   at java.lang.reflect.Method.invoke(Method.java:515) 
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) 
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 
   at dalvik.system.NativeStart.main(Native Method) 
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #0: invalid drawable tag vector
   at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:933)
   at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877)

1 个答案:

答案 0 :(得分:0)

来自documentation

  

Android 4.4(API级别20)及更低版本不支持矢量绘图。如果您的最低API级别设置为其中一个API级别,则在使用Vector Asset Studio时有两个选项:生成可移植网络图形(PNG)文件(默认)或使用支持库。

您需要检查是否使用了一些无法向后移植的功能,否则请使用支持库。