【问题标题】:Http Response issues after updating Libraries更新库后的 Http 响应问题
【发布时间】:2012-09-10 13:59:46
【问题描述】:

以下代码在我更新到最新的谷歌客户端api后抛出错误

 catch (IOException e) {
                if (e instanceof HttpResponseException) {
                    HttpResponse response = ((HttpResponseException) e)
                            .getResponse();//The error is here
                    int statusCode = response.getStatusCode();

在 getResponse 会抛出错误 The method getResponse() is undefined for the type HttpResponseException 我曾尝试回滚到以前版本的 api 但徒劳无功。

【问题讨论】:

    标签: android httpresponse google-api-java-client


    【解决方案1】:

    这个方法是removed in version 1.10Google HTTP Client Library

    异常现在有自己的getStatusCode() 方法。

    【讨论】:

    • 是的,在浪费了几个小时寻找解决方案后找到了它!再次感谢@Jan。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-08-20
    • 2019-09-14
    • 1970-01-01
    • 1970-01-01
    • 2012-09-23
    • 1970-01-01
    • 2018-12-07
    相关资源
    最近更新 更多