HttpLoggingInterceptor

HttpLoggingInterceptor

我的应用程序发布版本中的PlacesAPI有问题,如果我能看到来自OkHttpClient的日志,这将对我有很大帮助。我正在向它添加一个HttpLoggingInterceptor,但是我只能看到调试构建的日志。如何在发布版本中看到它们?

最佳答案

请检查你的代码,我想你已经这样添加了,这就是它发生的原因

if (BuildConfig.DEBUG) {
    HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
    logging.setLevel(Level.BODY);
    httpClient.addInterceptor(logging);
}

或者把你的代码贴在这里

10-02 00:33