3
votes

I am new to YouTube APIs. I have downloaded and imported yt-direct-lite youtube android project from github in my eclipse. Everything is fine. But, when I run the project it toast/pops up error message that :

[Error] Access not configured: The API (youTube Data API) is not enabled for your project. Please use google developer console to update your configuration.

However, I have already turned on Google+ API as well as YouTube Data API v3.

Also, I have generated API key. All the things are fine but when it goes to sign in for Google/Gmail account in the project. Also, fires below exception.

02-04 15:06:38.553: E/TetsProject(8413): Error
02-04 15:06:38.553: E/TetsProject(8413): com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
02-04 15:06:38.553: E/TetsProject(8413): {
02-04 15:06:38.553: E/TetsProject(8413):   "code": 403,
02-04 15:06:38.553: E/TetsProject(8413):   "errors": [
02-04 15:06:38.553: E/TetsProject(8413):     {
02-04 15:06:38.553: E/TetsProject(8413):       "domain": "usageLimits",
02-04 15:06:38.553: E/TetsProject(8413):       "message": "Access Not Configured. The API (YouTube Data API) is not enabled for your project. Please use the Google Developers Console to update your configuration.",
02-04 15:06:38.553: E/TetsProject(8413):       "reason": "accessNotConfigured",
02-04 15:06:38.553: E/TetsProject(8413):       "extendedHelp": "https://console.developers.google.com"
02-04 15:06:38.553: E/TetsProject(8413):     }
02-04 15:06:38.553: E/TetsProject(8413):   ],
02-04 15:06:38.553: E/TetsProject(8413):   "message": "Access Not Configured. The API (YouTube Data API) is not enabled for your project. Please use the Google Developers Console to update your configuration."
02-04 15:06:38.553: E/TetsProject(8413): }
02-04 15:06:38.553: E/TetsProject(8413):    at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)
02-04 15:06:38.553: E/TetsProject(8413):    at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)
02-04 15:06:38.553: E/TetsProject(8413):    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:312)
02-04 15:06:38.553: E/TetsProject(8413):    at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1049)
02-04 15:06:38.553: E/TetsProject(8413):    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410)
02-04 15:06:38.553: E/TetsProject(8413):    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)
02-04 15:06:38.553: E/TetsProject(8413):    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
02-04 15:06:38.553: E/TetsProject(8413):    at com.google.ytdl.MainActivity$3.doInBackground(MainActivity.java:417)
02-04 15:06:38.553: E/TetsProject(8413):    at com.google.ytdl.MainActivity$3.doInBackground(MainActivity.java:1)
02-04 15:06:38.553: E/TetsProject(8413):    at android.os.AsyncTask$2.call(AsyncTask.java:287)
02-04 15:06:38.553: E/TetsProject(8413):    at java.util.concurrent.FutureTask.run(FutureTask.java:234)
02-04 15:06:38.553: E/TetsProject(8413):    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
02-04 15:06:38.553: E/TetsProject(8413):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
02-04 15:06:38.553: E/TetsProject(8413):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
02-04 15:06:38.553: E/TetsProject(8413):    at java.lang.Thread.run(Thread.java:856)
02-04 15:06:38.633: I/brcm-gr(8413): [gralloc_lock]: new usage 0x933

I don't know what's wrong with it?

3

3 Answers

3
votes

I have solved this problem after some RnD. The thing is first enable youtubeapi v3 and google+ api then go to credential and before generating Android API key.

First generate the client id by clicking "create new client id" then select installed application and choose Android. Below you have to give the exact package name of you app and sha1 fingerprint then select deep linking and at last create client id.

After created then create the android api key for player youtube video. Then your api key will be working. Remember in filling your package name, your package name will be same with your app in eclipe or studio.

If after creating client id, you changed your package name then you key will not work. Remember pckg name is restricted here, and will not have to be changed.

1
votes

I had similar problem.. It was solved by using browser api key and allow all referers in the admin console..

From the Admin Console Api&Auth - create new api key just like you are creating one for android.. But choose Browser Key.. Follow the steps and when it asks for referers just leave it blank.. By doing that you allow all referers to access using that key.. I hope this helps :)

0
votes

I replaced Android Key by Browser key. It helped me & works now.