记录工作中的点点滴滴之异常

在近期的工作中,报出了这一异常导致程序直接崩溃,经多方查阅

2021-06-18 14:17:46.325 15201-15201/com.icbc.im E/ActivityInjector: get life cycle exception

    java.lang.ClassCastException: android.os.BinderProxy cannot be cast to android.app.servertransaction.ClientTransaction

        at android.app.ActivityInjector.checkAccessControl(ActivityInjector.java:24)

        at android.app.Activity.onResume(Activity.java:1854)

        at android.support.v4.app.FragmentActivity.onResume(FragmentActivity.java:485)

        at com.icbc.im.ui.activity.BaseActivity.onResume(BaseActivity.java:189)

        at com.icbc.chat.activity.WebViewActivity.onResume(WebViewActivity.java:3343)

        at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1454)

        at android.app.Activity.performResume(Activity.java:8051)

是因为小米的MIUI11/12主题切换 具体解释如下:

Since MIUI 11/12 Use Its Own Custom Implementation of Dark Mode, using below code results in ClassCastException and Activity Life Cycle Exception, as DefaultNightMode and LocalNightMode is always Unspecified i.e. -100 instead of 0 or 1.

给到的建议是:

Just goto values.xml and place this in your AppTheme

进入values.xml中并把<item name="android:forceDarkAllowed" >false</item> 添加到AppTheme中。

再次记录一下以便后续工作。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容