我有这些代码行
公共类RetrofitClient {
private static Retrofit retrofit=null;
public static Retrofit getClient(String baseUrl)
{
if(retrofit==null)
{
retrofit = new Retrofit().Builder()
.baseUrl(baseUrl)
.addConverterFactory(GsonConverterFactory.create())
.build();
}
return retrofit;
}}
我得到了这个错误..。
错误:类调整中的构造函数重新配置不能应用于给定类型;所需: okhttp3.Call.Factory、HttpUrl、List、List、Executor、布尔查找:无参数原因:实际参数列表和形式参数列表长度不同
如果我把光标放在错误调整上,我可以看到它是这样写的
重装(okhttp3.)在“更新2”中不是公开的。不能从外部包访问
有什么帮助吗?
发布于 2018-08-18 13:41:32
您的代码应该是正确的,如下所述。
public class RetrofitClient {
private static Retrofit retrofit = null;
public static Retrofit getClient1(String baseUrl) {
if (retrofit == null) {
retrofit = new Retrofit.Builder()
.baseUrl(baseUrl)
.addConverterFactory(GsonConverterFactory.create())
.build();
}
return retrofit;
}
}发布于 2018-07-03 17:22:11
好吧我的错..。我应该使用Retrofit.Builder()而不是Retrofit().Builder()。
https://stackoverflow.com/questions/51159816
复制相似问题