问题
I'm trying to execute the Search by keyword sample code from YouTube Data API Java Samples collection.
In order to do that I:
- Created a new project in IntelliJ IDEA.
- Downloaded latest google-api-java-client-featured.zip.
- Added the libraries from the
google-api-java-client-featured
to the project via Project Structure → Libraries → New Project Library. - 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