AndroidX库与Lollipop向后兼容。可绘制资源问题

时间:2020-01-11 06:31:52

标签: drawable compatibility androidx

我确实进行了很多搜索和Google搜索。但是没有找到任何解决方案。我真的很抱歉,如果已经以某种方式解决了该问题(我试图找到的最好方法-没有结果)。

总的来说,我遇到这样的问题:在迁移到anroidx库而不是支持库之后,我遇到了与Lollipop上可绘制资源有关的崩溃。

赞:

原因:android.content.res.Resources $ NotFoundException:来自可绘制资源ID#0x10800d4的文件res / drawable / btn_borderless_material.xml

我正在尝试使用所有可能的解决方案,该解决方案解决了矢量图形在支持库上的Android 5上无法运行的问题,但是它们都对androidx库没有帮助。上面的错误与首选项片段对话框有关(当在弹出窗口中更改值时,例如设置整数值等)。

anroidx和最新的android studio至少有任何解决方法可以使其在Lollipop上正常工作吗?

这对adroidx库的使用没有影响:

vectorDrawables.useSupportLibrary = true

错误仍然存​​在,我完全不知道如何最终解决。

将非常感谢任何可以帮助我的人。目标SDK是29。

完整的崩溃日志:

E / AndroidRuntime:致命异常:主要

android.view.InflateException: Binary XML file line #37: Error inflating class Button
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:763)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
    at android.view.LayoutInflater.parseInclude(LayoutInflater.java:916)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:802)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
    at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:555)
    at androidx.appcompat.app.AppCompatDialog.setContentView(AppCompatDialog.java:95)
    at androidx.appcompat.app.AlertController.installContent(AlertController.java:232)
    at androidx.appcompat.app.AlertDialog.onCreate(AlertDialog.java:279)
    at android.app.Dialog.dispatchOnCreate(Dialog.java:373)
    at android.app.Dialog.show(Dialog.java:274)
    at androidx.fragment.app.DialogFragment.onStart(DialogFragment.java:486)
    at androidx.fragment.app.Fragment.performStart(Fragment.java:2632)
    at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:915)
    at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238)
    at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303)
    at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:439)
    at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManagerImpl.java:2079)
    at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1869)
    at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1824)
    at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1727)
    at androidx.fragment.app.FragmentManagerImpl$2.run(FragmentManagerImpl.java:150)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5221)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
 Caused by: android.content.res.Resources$NotFoundException: File res/drawable/btn_borderless_material.xml from drawable resource ID #0x10800d4
    at android.content.res.Resources.loadDrawableForCookie(Resources.java:2428)
    at android.content.res.Resources.loadDrawable(Resources.java:2330)
    at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
    at android.view.View.<init>(View.java:3730)
    at android.widget.TextView.<init>(TextView.java:634)
    at android.widget.Button.<init>(Button.java:111)
    at android.widget.Button.<init>(Button.java:107)
    at androidx.appcompat.widget.AppCompatButton.<init>(AppCompatButton.java:72)
    at androidx.appcompat.widget.AppCompatButton.<init>(AppCompatButton.java:68)
    at androidx.appcompat.app.AppCompatViewInflater.createButton(AppCompatViewInflater.java:192)
    at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:111)
    at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1407)
    at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1457)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:725)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) 
    at android.view.LayoutInflater.parseInclude(LayoutInflater.java:916) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:802) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:504) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:365) 
    at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:555) 
    at androidx.appcompat.app.AppCompatDialog.setContentView(AppCompatDialog.java:95) 
    at androidx.appcompat.app.AlertController.installContent(AlertController.java:232) 
    at androidx.appcompat.app.AlertDialog.onCreate(AlertDialog.java:279) 
    at android.app.Dialog.dispatchOnCreate(Dialog.java:373) 
    at android.app.Dialog.show(Dialog.java:274) 
    at androidx.fragment.app.DialogFragment.onStart(DialogFragment.java:486) 
    at androidx.fragment.app.Fragment.performStart(Fragment.java:2632) 
    at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:915) 
    at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238) 
    at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303) 
    at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:439) 
    at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManagerImpl.java:2079) 
    at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1869) 
    at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1824) 
    at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1727) 
    at androidx.fragment.app.FragmentManagerImpl$2.run(FragmentManagerImpl.java:150) 
    at android.os.Handler.handleCallback(Handler.java:739) 
    at android.os.Handler.dispatchMessage(Handler.java:95) 
    at android.os.Looper.loop(Looper.java:135) 
    at android.app.ActivityThread.main(ActivityThread.java:5221) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at java.lang.reflect.Method.invoke(Method.java:372) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) 
 Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1d
    at android.content.res.TypedArray.getDimensionPixelOffset(TypedArray.java:533)
    at android.graphics.drawable.LayerDrawable.updateLayerFromTypedArray(LayerDrawable.java:234)
    at android.graphics.drawable.LayerDra

I / Process:正在发送信号。 PID:4460 SIG:9 进程4460已终止。

0 个答案:

没有答案