I followed this tutorial https://developers.google.com/youtube/v3/code_samples/java#search_by_keyword
to retreive youtube videos based on keyword using YouTubeData API
This section is giving me the error:
"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();
I think that this class is not being imported
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?
These two defines can be found in the youtube example: Auth.java file from example
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.
Hopes this helps, BR, Adrian.
来源:https://stackoverflow.com/questions/24065065/having-trouble-importing-google-api-services-samples-youtube-cmdline-auth