• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Adding dependencies to YouTube OAuth2.0 project

spiteria

Lurker
Feb 20, 2016
3
0
I'm trying to add some YouTube OAuth2.0 authorization for an Android project I'm working on using Android Studio. I got some sample code from here http://bit.ly/1SI805S. I'm pretty sure I linked to it from a Google developers site. I'm trying to add some libraries to take care of the dependencies but it isn't recognizing them. Here are the dependencies:

import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.util.store.DataStoreFactory;
import com.google.api.client.util.store.FileDataStoreFactory;
import com.google.api.services.oauth2.Oauth2;
import com.google.api.services.oauth2.model.Tokeninfo;
import com.google.api.services.oauth2.model.Userinfoplus;

I downloaded a .jar for the com.google.api.services dependencies and that is working fine. I found the file on the Google developers site and it's google-api-services-oauth2-v2-rev103-1.21.0.jar.

However, all of the api.client jars I've found are not working. I put them in the libs folder and add compile files to the build.gradle but it won't recognize the imports. The jars I've used thus far are
google-api-client-util-1.2.3-alpha.jar
google-api-client-extensions-1.6.0-beta.jar
google-api-client-auth-1.2.3-alpha.jar

Is there anything I'm missing? I've found these files in different parts of the net. I've looked through maven repositories and I just found a site, http://www.java2s.com/Code/Jar/g/Downloadgoogleapiclientutil121alphajar.htm, but I don't know that it's helpful. There's some api.client stuff I downloaded from the Google Developers site but that doesn't look like anything I need and it doesn't resolve the dependencies.
 
I was on stackoverflow here and got a partial solution to the problem, http://bit.ly/24iIDvj. I'm still having an issue though. I was using Bintray to find the jar files and I found one that worked but every other file I added didn't do anything.

Bintray worked for a couple of the dependencies. google.api.client-1.21.0 took care client.googleapis but client.extensions, client.auth, client.json, and client.util still aren't resolving. I've added a few jars as libraries, google-api-client-auth-oauth2-1.2.0-alpha.jar, google-api-client-util-1.2.3-alpha.jar, google-client-api-1.0.4.jar and a few others.
 
Upvote 0
I was on stackoverflow here and got a partial solution to the problem, http://bit.ly/24iIDvj. I'm still having an issue though. I was using Bintray to find the jar files and I found one that worked but every other file I added didn't do anything.

Bintray worked for a couple of the dependencies. google.api.client-1.21.0 took care client.googleapis but client.extensions, client.auth, client.json, and client.util still aren't resolving. I've added a few jars as libraries, google-api-client-auth-oauth2-1.2.0-alpha.jar, google-api-client-util-1.2.3-alpha.jar, google-client-api-1.0.4.jar and a few others.

The stackoverflow answer worked. I just needed to add it with the correct version. I got it from the maven repository.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones