gpt4 book ai didi

android - 改造不会在断点处停止

转载 作者:行者123 更新时间:2023-11-30 00:08:22 24 4
gpt4 key购买 nike

我正面临这个问题,当我调用改造时,该调用不会在断点处停止。

ClashResponse clashResponse = new ClashResponse();

clashApi = clashResponse.getClashApi();

clashApi.getAllArenas().enqueue(new Callback<String>() {
@Override
public void onResponse(Call<String> call, Response<String> response) {
ClashApiBuilder<ArenaData> clashApiBuilder = new ClashApiBuilder(ArenaData.class);

arenaList = clashApiBuilder.convert(String.valueOf(call));
}

@Override
public void onFailure(Call<String> call, Throwable t) {
t.getCause();
}
});

我的毕业典礼

  //Retrofit
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.3.0'
compile 'com.squareup.retrofit2:retrofit:2.3.0'

我的 retrofit builder :

public ClashResponse(){
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(SERVER_URL)
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.build();

return retrofit.create(ClashApi.class);
}

最佳答案

如果您想调试您的 Api 调用,请使用 chuck 拦截器,它只能在 Debug模式下工作。在您的应用程序 build.gradle 中添加以下依赖项。

 debugCompile 'com.readystatesoftware.chuck:library:1.1.0'
releaseCompile 'com.readystatesoftware.chuck:library-no-op:1.1.0'

获取okHttp3的引用

 public OkHttpClient getClient(Context context) {
// Add the interceptor to OkHttpClient
OkHttpClient.Builder builder = new OkHttpClient.Builder();
builder.addInterceptor(new ChuckInterceptor(context));
builder.readTimeout(READ_TIMEOUT, TimeUnit.MINUTES);
builder.connectTimeout(CONNECT_TIMEOUT, TimeUnit.MINUTES);
return builder.build();
}

现在获取 Retrofit 实例并添加此 okHttp 客户端

 public RestApi connectToApi() {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(BASE_DOC_URL)
//Data converter
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.client(getClient(context))
.build();
return retrofit.create(RestApi.class);
}

现在您可以从通知栏跟踪所有 Api 调用。

关于android - 改造不会在断点处停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48594417/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com