Tamicer / Novate

A safety client by Https for android, (Android网络框架,基于Retrofit和RxJava打造的链式网络库, 支持okhttp的调用风格,又兼容Retrofit API,并支持rxJava链式操作)
Apache License 2.0
1.43k stars 268 forks source link

在设置了baseUrl之后,在程序运行的过程中偶尔会出现Base URL required 导致App崩溃 #87

Open Huwei1993 opened 6 years ago

Huwei1993 commented 6 years ago

是retorfit 当中报出来的,不是novate 报错信息: FATAL EXCEPTION: mqt Process: com.ocj.oms.mobile, PID: 17343 java.lang.IllegalStateException: Base URL required. at retrofit2.Retrofit$Builder.build(Retrofit.java:563) at com.novate.Novate$Builder.build(Novate.java:2921) at com.**..service.novate.NovateGenerator.createNovate(NovateGenerator.java:67) at com.**.base.App.initRNNovate(App.java:430) at com.**.ui.rn.RouterModule.getAPIKey(RouterModule.java:1283) at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:345) at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:141) at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) at android.os.Handler.handleCallback(Handler.java:754) at android.os.Handler.dispatchMessage(Handler.java:95) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31) at android.os.Looper.loop(Looper.java:163) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196) at java.lang.Thread.run(Thread.java:760)

调用地方: public Novate createNovate() { if (TextUtils.isEmpty(ApiHost.API_HOST)){ ApiHost.API_HOST = BuildConfig.ApiUrl; } // 该log用于检测 Base Url 为 空的情况下App崩溃问题 Log.e("ApiHost.API_HOST","createNovate ApiHost.API_HOST:" + ApiHost.API_HOST); return createBuilder() .baseUrl(ApiHost.API_HOST) .connectTimeout(30) .writeTimeout(30) .build(); }

/**

Tamicer commented 6 years ago

baseUrl不合法吧?

Huwei1993 commented 6 years ago

只有在快速多次请求的时候会报错,一般情况下是不会出现异常