Cannot resolve YouTube class/symbol, YouTube Data API Java sample issue

寵の児 提交于 2019-12-12 02:13:40

问题


I'm trying to execute the Search by keyword sample code from YouTube Data API Java Samples collection.

In order to do that I:

  1. Created a new project in IntelliJ IDEA.
  2. Downloaded latest google-api-java-client-featured.zip.
  3. Added the libraries from the google-api-java-client-featured to the project via Project Structure → Libraries → New Project Library.
  4. Created a class Search.java and copy pasted the sample.

IDEA can't resolve YouTube class:

/**
 * Define a global instance of a Youtube object, which will be used
 * to make YouTube Data API requests.
 */
private static YouTube youtube;

My question:
Where can I find this YouTube class or what have I to do in order to be able to execute the official YouTube Data API Java sample?


回答1:


It appears that there is more to download. You got everything except the actual YouTube Data API. As of this writing it can be found at https://developers.google.com/api-client-library/java/apis/youtube/v3. At that site there is the option to download a .zip file, or obtain through Maven or Gradle.

I found it by searching (googling) for the class com.google.api.services.youtube.YouTube, which I found listed as an import in the Sample that you linked above.



来源:https://stackoverflow.com/questions/35241129/cannot-resolve-youtube-class-symbol-youtube-data-api-java-sample-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!