导入"google.api.services.samples.youtube.cmdline.Auth;"时遇到问题? [英] Having trouble importing "google.api.services.samples.youtube.cmdline.Auth;"?
问题描述
我遵循了本教程 https://developers.google.com/youtube/v3/code_samples/java#search_by_keyword
使用YouTubeData API检索基于关键字的youtube视频
to retreive youtube videos based on keyword using YouTubeData API
此部分给我错误:
"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;
我在互联网上搜索了其他有此问题的人,但问题从未得到解决....有人可以帮助我吗?
I've searched the internet for someone else having this problem but the question was never answered....can someone please help me?
推荐答案
这两个定义可以在youtube示例中找到: 示例中的Auth.java文件
These two defines can be found in the youtube example: Auth.java file from example
您是否可以按以下方式替换Builder字符串:
Are you can just replace the Builder string as follows:
new YouTube.Builder(new NetHttpTransport(), new JacksonFactory(), new HttpRequestInitializer()
这可以解决问题,就像找到定义一样.
This will do the trick, same as finding the defines.
希望这会有所帮助, BR 阿德里安.
Hopes this helps, BR, Adrian.
这篇关于导入"google.api.services.samples.youtube.cmdline.Auth;"时遇到问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!