Blankj / AndroidUtilCode

:fire: Android developers should collect the following utils(updating).
https://blankj.com/2016/07/31/android-utils-code/
Apache License 2.0
33.32k stars 10.69k forks source link

获取设备id时报错 #1777

Open yiyuan-588 opened 1 year ago

yiyuan-588 commented 1 year ago

Process Name: 'com.feemoo:pushcore' Thread Name: 'RxCachedThreadScheduler-1' Back traces starts. io.reactivex.exceptions.UndeliverableException: The exception could not be delivered to the consumer because it has already canceled/disposed the flow or the exception has nowhere to go to begin with. Further reading: https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0#error-handling | java.lang.ExceptionInInitializerError at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:367) at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:69) at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57) at java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:307) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at java.lang.Thread.run(Thread.java:1012) Caused by: java.lang.ExceptionInInitializerError at com.blankj.utilcode.util.UtilsBridge.getApplicationByReflect(UtilsBridge.java:104) at com.blankj.utilcode.util.Utils.getApp(Utils.java:71) at com.blankj.utilcode.util.SPUtils.(SPUtils.java:84) at com.blankj.utilcode.util.SPUtils.getInstance(SPUtils.java:71) at com.blankj.utilcode.util.SPUtils.getInstance(SPUtils.java:54) at com.blankj.utilcode.util.UtilsBridge.getSpUtils4Utils(UtilsBridge.java:518) at com.blankj.utilcode.util.DeviceUtils.getUniqueDeviceId(DeviceUtils.java:504) at com.blankj.utilcode.util.DeviceUtils.getUniqueDeviceId(DeviceUtils.java:458) at com.feemoo.utils.ActivityUtils.getUniqueCode(ActivityUtils.java:627) at com.feemoo.network.util.HeaderRequestInterceptor.intercept(HeaderRequestInterceptor.java:45) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117) at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:229) at okhttp3.RealCall.execute(RealCall.java:81) at retrofit2.OkHttpCall.execute(OkHttpCall.java:204) at com.jakewharton.retrofit2.adapter.rxjava2.CallObservable.subscribeActual(CallObservable.java:41) at io.reactivex.Observable.subscribe(Observable.java:12284) at com.jakewharton.retrofit2.adapter.rxjava2.BodyObservable.subscribeActual(BodyObservable.java:34) at io.reactivex.Observable.subscribe(Observable.java:12284) at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96) at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:608) at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66) ... 6 more Caused by: java.lang.RuntimeException: Can't create handler inside thread Thread[RxCachedThreadScheduler-1,5,main] that has not called Looper.prepare() at android.os.Handler.(Handler.java:227) at android.os.Handler.(Handler.java:129) at android.app.Activity.(Activity.java:941) at com.blankj.utilcode.util.UtilsActivityLifecycleImpl.(UtilsActivityLifecycleImpl.java:40) ... 28 more Back traces ends.

ZackLee commented 7 months ago

看日志推测,是com.feemoo:pushcore 推送这个进程没有初始化 Utils.init(this)