在近期的工作中,報出了這一異常導(dǎo)致程序直接崩潰仍翰,經(jīng)多方查閱
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
進(jìn)入values.xml中并把<item name="android:forceDarkAllowed" >false</item> 添加到AppTheme中洁闰。
再次記錄一下以便后續(xù)工作。