我的App在Android 26上崩溃,我理解是由于字体和支持库引起的,但我不知道为什么。 在Android 8.0以下的设备上,它可以正常工作。
Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class Button
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at android.support.v4.graphics.TypefaceCompatApi26Impl.addFontFromAssetManager(TypefaceCompatApi26Impl.java:150)
at android.support.v4.graphics.TypefaceCompatApi26Impl.createFromFontFamilyFilesResourceEntry(TypefaceCompatApi26Impl.java:218)
at android.support.v4.graphics.TypefaceCompat.createFromResourcesFamilyXml(TypefaceCompat.java:116)
at android.support.v4.content.res.ResourcesCompat.loadFont(ResourcesCompat.java:249)
at android.support.v4.content.res.ResourcesCompat.loadFont(ResourcesCompat.java:213)
at android.support.v4.content.res.ResourcesCompat.getFont(ResourcesCompat.java:206)
at android.support.v7.widget.TintTypedArray.getFont(TintTypedArray.java:119)
at android.support.v7.widget.AppCompatTextHelper.updateTypefaceAndStyle(AppCompatTextHelper.java:208)
at android.support.v7.widget.AppCompatTextHelper.loadFromAttributes(AppCompatTextHelper.java:152)
at android.support.v7.widget.AppCompatTextHelperV17.loadFromAttributes(AppCompatTextHelperV17.java:38)
at android.support.v7.widget.AppCompatButton.<init>(AppCompatButton.java:77)
at android.support.v7.widget.AppCompatButton.<init>(AppCompatButton.java:67)
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:109)
at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1024)
at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1081)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:772)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at android.support.v4.graphics.TypefaceCompatApi26Impl.addFontFromAssetManager(TypefaceCompatApi26Impl.java:145)
... 42 more
Caused by: java.lang.NullPointerException
at android.graphics.FontFamily.nAddFontFromAssetManager(Native Method)
at android.graphics.FontFamily.addFontFromAssetManager(FontFamily.java:149)
... 44 more