0

I'm trying to run the task-android-sample code that I found here: http://samples.google-api-java-client.googlecode.com/hg/tasks-android-sample/instructions.html

I successfully imported it to Eclipse and added all the necessary dependencies using the Google Eclipse plugin: https://developers.google.com/eclipse/docs/googleapis

I changed the package name of the project's package to a custom value, which was suggested by the instruction.

I created a new project in my Google Developer Console, made sure that the Tasks API is ON, and added a new key in the credentials tab. Inside the key I inserted my SHA1 certificate fingerprint (which I took from Eclipse: Window/Preferences/Android/Build), and my newly changed package name.

When I run the sample app from Eclipse, I see two dialogs asking me to give it permissions to access the tasks, and then the following message:

[Error] Access Not Configured. Please use Google Developers Console to activate the API for your project.

My LogCat displays the following:

02-11 20:33:32.593: E/TasksSample(9231): Error
02-11 20:33:32.593: E/TasksSample(9231): com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
02-11 20:33:32.593: E/TasksSample(9231): {
02-11 20:33:32.593: E/TasksSample(9231):   "code": 403,
02-11 20:33:32.593: E/TasksSample(9231):   "errors": [
02-11 20:33:32.593: E/TasksSample(9231):     {
02-11 20:33:32.593: E/TasksSample(9231):       "domain": "usageLimits",
02-11 20:33:32.593: E/TasksSample(9231):       "message": "Access Not Configured. Please use Google Developers Console to activate the API for your project.",
02-11 20:33:32.593: E/TasksSample(9231):       "reason": "accessNotConfigured"
02-11 20:33:32.593: E/TasksSample(9231):     }
02-11 20:33:32.593: E/TasksSample(9231):   ],
02-11 20:33:32.593: E/TasksSample(9231):   "message": "Access Not Configured. Please use Google Developers Console to activate the API for your project."
02-11 20:33:32.593: E/TasksSample(9231): }
02-11 20:33:32.593: E/TasksSample(9231):    at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)
02-11 20:33:32.593: E/TasksSample(9231):    at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)
02-11 20:33:32.593: E/TasksSample(9231):    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:312)
02-11 20:33:32.593: E/TasksSample(9231):    at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1045)
02-11 20:33:32.593: E/TasksSample(9231):    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410)
02-11 20:33:32.593: E/TasksSample(9231):    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)
02-11 20:33:32.593: E/TasksSample(9231):    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
02-11 20:33:32.593: E/TasksSample(9231):    at pl.bartoszwesolowski.taskssample.AsyncLoadTasks.doInBackground(AsyncLoadTasks.java:38)
02-11 20:33:32.593: E/TasksSample(9231):    at pl.bartoszwesolowski.taskssample.CommonAsyncTask.doInBackground(CommonAsyncTask.java:53)
02-11 20:33:32.593: E/TasksSample(9231):    at pl.bartoszwesolowski.taskssample.CommonAsyncTask.doInBackground(CommonAsyncTask.java:1)
02-11 20:33:32.593: E/TasksSample(9231):    at android.os.AsyncTask$2.call(AsyncTask.java:288)
02-11 20:33:32.593: E/TasksSample(9231):    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
02-11 20:33:32.593: E/TasksSample(9231):    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
02-11 20:33:32.593: E/TasksSample(9231):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
02-11 20:33:32.593: E/TasksSample(9231):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
02-11 20:33:32.593: E/TasksSample(9231):    at java.lang.Thread.run(Thread.java:841)

Was anyone able to run the sample code successfully? What can I do to get rid of the error?

Bartek
  • 1,327
  • 1
  • 11
  • 22

2 Answers2

0

I had the same problem yesterday, tried for hours different stuff and nothing worked until I did this on the API Console (apparently one or the combination of these things made it work):

1- On the APIs tab (inside Apis & auth) I disabled all the APIs, except for the Tasks API.

2- On the Credentials tab (inside Apis & auth) I deleted the Client ID and the API key I had created before, then I created a new OAuth Client ID (I didn't create a new API key because apparently that is not needed for the Tasks API when using OAuth).

So after doing those things my app starting working "magically" (which is another way of saying I have no idea why :P).

Btw the app didn't work when running it from Android Studio (or Eclipse in your case) but it did when I compiled the signed apk and installed it on the phone (this is because the way the new Tasks API detects if your app can communicate with it is through the SHA1 certificate, which is only added to the app when you sign it using the keystore).

Anyway I hope this helps you and other people with the same issue.

Cheers.

Franco
  • 2,711
  • 2
  • 20
  • 27
0

I was facing the exact same problem. I've controlled the Google Developer Console using Iceweasel with debian stretch (testing). I've then switched to Win 10 with firefox and created a new project. It suddenly worked then. I think the Google Developer Console is not working correctly with Iceweasel.

Burtan
  • 41
  • 4