【发布时间】:2020-07-08 07:52:03
【问题描述】:
第一次使用 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: 致命异常: main 进程:,PID:5305 java.lang.ExceptionInInitializerError
【问题讨论】:
标签: android-studio retrofit2 okhttp