美文网首页kotlin
kotlin bug: Parameter specified

kotlin bug: Parameter specified

作者: 月未雪 | 来源:发表于2019-12-11 12:02 被阅读0次

    kotlin bug: java.lang.IllegalArgumentException: Parameter specified as non-null is null

    错误日志

    E/CrashHandler: In thread: Thread[main,5,main]
    UncaughtException detected: java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.
    at io.reactivex.android.schedulers.HandlerSchedulerScheduledRunnable.run(HandlerScheduler.java:111) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6211) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInitMethodAndArgsCaller.run(ZygoteInit.java:903)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:793)
    Caused by: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter object
    at io.reactivex.internal.operators.observable.ObservableObserveOnObserveOnObserver.drainNormal(ObservableObserveOn.java:200) at io.reactivex.internal.operators.observable.ObservableObserveOnObserveOnObserver.run(ObservableObserveOn.java:252)
    at io.reactivex.android.schedulers.HandlerSchedulerScheduledRunnable.run(HandlerScheduler.java:109) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6211) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInitMethodAndArgsCaller.run(ZygoteInit.java:903)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:793)

          代码:
          RetrofitApi.getInstance().saveLocationMsg(regionProvinceId, regionCityId, regionAreaId, purchaseName, purchasePhone, userAddress).
                    subscribeOn(Schedulers.io()).
                    observeOn(AndroidSchedulers.mainThread()).
                    subscribe(object : RxSubcriber<Any>() {
    
                override fun onSuccess(t: Any?) {
                    if (isViewAttached) {
                        mMvpView.saveCallBack(t)
                    }
                }
        
                override fun onError(e: Throwable?) {
                    if (isViewAttached) {
                    }
                    super.onError(e)
                }
            })
        }
    
    

    解决办法: 回调方法参数后面声明加? 允许为null

    相关文章

      网友评论

        本文标题:kotlin bug: Parameter specified

        本文链接:https://www.haomeiwen.com/subject/gosogctx.html