【问题标题】:Having trouble importing "google.api.services.samples.youtube.cmdline.Auth;"?导入“google.api.services.samples.youtube.cmdline.Auth;”时遇到问题?
【发布时间】:2014-06-05 16:08:00
【问题描述】:

我按照这个教程https://developers.google.com/youtube/v3/code_samples/java#search_by_keyword

使用 YouTubeData API 根据关键字检索 youtube 视频

这部分给了我错误: "Error:(117, 43) error: cannot find symbol variable auth"

youtube = new YouTube.Builder(Auth.HTTP_TRANSPORT, Auth.JSON_FACTORY, new HttpRequestInitializer() {
                public void initialize(com.google.api.client.http.HttpRequest request) throws IOException {
                }
            })
                    .setApplicationName("youtube-cmdline-search-sample")
                    .build();

我认为这个类没有被导入

import com.google.api.services.samples.youtube.cmdline.Auth;

我在互联网上搜索过有此问题的其他人,但问题从未得到解答....有人可以帮助我吗?

【问题讨论】:

    标签: android-youtube-api


    【解决方案1】:

    这两个定义可以在 youtube 示例中找到: Auth.java file from example

    你可以只替换 Builder 字符串如下:

    new YouTube.Builder(new NetHttpTransport(), new JacksonFactory(), new HttpRequestInitializer() 
    

    这将起到作用,与查找定义相同。

    希望这会有所帮助, BR, 阿德里安。

    【讨论】:

    • 这个库不是谷歌的吗?为什么它支持 Jackson 而不是 Gson?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-18
    • 2012-01-07
    • 2012-12-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多