几天前将我的 Android Studio 更新到最新版本后,我在改造和 okhttp 方面遇到了问题。在此之前,我的代码可以正常工作,没有任何问题。这是改造客户端的类,它崩溃了
public class ApiClient {
public static final String BASE_URL = "myapiurl";
private static Retrofit mRetrofit = null;
public static Retrofit getClient() {
if (mRetrofit ==null) {
Gson gson = new GsonBuilder()
.setLenient()
.setDateFormat("yyyy-MM-dd'T'HH:mm:ss")
.create();
mRetrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create(gson))
.build();
}
return mRetrofit;
}
Run Code Online (Sandbox Code Playgroud)
}
我得到的错误非常普遍,我不知道下一步该去哪里。
2019-03-03 07:15:15.774 21769-21769/com.instreamwater.app E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.instreamwater.app, PID: 21769
java.lang.BootstrapMethodError: Exception from call site #0 bootstrap method
at okhttp3.internal.Util.<clinit>(Unknown Source:111)
at okhttp3.internal.Util.skipLeadingAsciiWhitespace(Unknown Source:0)
at okhttp3.HttpUrl$Builder.parse(Unknown …Run Code Online (Sandbox Code Playgroud)