android.view.InflateException; java.lang.reflect.InvocationTargetException;java.lang.UnsupportedOper

适配androidQ新基线。
androidx包问题。

Process: com.android.settings, PID: 32380
    android.view.InflateException: Binary XML file line #26 in com.android.settings:layout/abc_alert_dialog_material: Binary XML file line #45 in com.android.settings:layout/abc_alert_dialog_title_material: Error inflating class androidx.appcompat.widget.DialogTitle
    Caused by: android.view.InflateException: Binary XML file line #45 in com.android.settings:layout/abc_alert_dialog_title_material: Error inflating class androidx.appcompat.widget.DialogTitle
    Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Constructor.newInstance0(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
        at android.view.LayoutInflater.createView(LayoutInflater.java:854)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1006)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:1123)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:1126)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
        at android.view.LayoutInflater.parseInclude(LayoutInflater.java:1263)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:1119)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:682)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:481)
        at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:545)
        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:421)
        at android.app.Dialog.show(Dialog.java:315)
        at androidx.fragment.app.DialogFragment.onStart(DialogFragment.java:486)
        at androidx.fragment.app.Fragment.performStart(Fragment.java:2627)
        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:2076)
        at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1866)
        at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1821)
        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:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7514)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:938)
     Caused by: android.content.res.Resources$NotFoundException: File res/color/highlighted_text_material.xml from ComplexColor resource ID #0x1060163
        at android.content.res.ResourcesImpl.loadComplexColorForCookie(ResourcesImpl.java:1187)
        at android.content.res.ResourcesImpl.loadComplexColorFromName(ResourcesImpl.java:1013)
        at android.content.res.ResourcesImpl.loadColorStateList(ResourcesImpl.java:1092)
        at android.content.res.Resources.loadColorStateList(Resources.java:1062)
        at android.content.res.TypedArray.getColor(TypedArray.java:519)
2019-08-26 10:06:05.163 32380-32380/com.android.settings E/AndroidRuntime:     at android.widget.TextView.readTextAppearance(TextView.java:3973)
        at android.widget.TextView.(TextView.java:1035)
        at android.widget.TextView.(TextView.java:976)
        at androidx.appcompat.widget.AppCompatTextView.(AppCompatTextView.java:99)
        at androidx.appcompat.widget.AppCompatTextView.(AppCompatTextView.java:95)
        at androidx.appcompat.widget.DialogTitle.(DialogTitle.java:44)
        	... 39 more
     Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 0 to color: type=0x1
        at android.content.res.TypedArray.getColor(TypedArray.java:532)
        at android.content.res.ColorStateList.inflate(ColorStateList.java:333)
        at android.content.res.ColorStateList.createFromXmlInner(ColorStateList.java:281)
        at android.content.res.ResourcesImpl.loadComplexColorForCookie(ResourcesImpl.java:1180)
        	... 49 more

解决方法:

    @style/Theme.AlertDialog

改为:

    @style/Theme.AppCompat.Dialog.Alert		

你可能感兴趣的:(android,android异常)