在android中使用google客户端api时,如何克服400个错误请求?

在android中使用google客户端api时,如何克服400个错误请求?,android,youtube,google-api-client,Android,Youtube,Google Api Client,我正在使用谷歌客户端api将youtube集成到我的android应用程序中。我正在使用这个代码 YouTubeUrl url = new YouTubeUrl(VIDEOS_FEED); url.author = "searchstories"; url.maxResults = 2; // build the HTTP GET request HttpRequest request; try { request = factory.bu

我正在使用谷歌客户端api将youtube集成到我的android应用程序中。我正在使用这个代码

YouTubeUrl url = new YouTubeUrl(VIDEOS_FEED);
    url.author = "searchstories";
    url.maxResults = 2;
    // build the HTTP GET request
    HttpRequest request;
    try {
        request = factory.buildGetRequest(url);
        // execute the request and the parse video feed
        VideoFeed feed = request.execute().parseAs(VideoFeed.class);

在获取提要时,它抛出com.google.api.client.http.HttpResponseException:400错误请求。最初几次它工作正常,然后它给出了400个错误的请求。如何克服这个问题?请帮忙。提前感谢。

事实上,我没有添加标题

GoogleHeaders=新的GoogleHeaders()

headers.setApplicationName(“TestApp/1.0”)

headers.gdataVersion=“2”; request.headers=头

将头添加到HttpRequest解决了400错误请求异常。
享受

你能告诉我哪个图书馆有GoogleHeaders…thanx吗