第一次使用 httpOk 和改造。我正在使用另一名员工的代码,但无法使其工作,即使在进入互联网检查潜在错误之后也是如此。
public static Retrofit getBsfBuilder() {
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build();
retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.client(client)
.build();
return retrofit;
}
使用上面的 BASE_URL 声明,并将改造为 null。
错误是
E/AndroidRuntime:致命异常:主进程:,PID:5305 java.lang.ExceptionInInitializerError