I am creating a Google Drive Integration in my existing app.

I have followed Google Drive Integration instructions.

I have created Oauth 2.0 client key for android using sha1 and package name.

I am just using code from below link for testing purpose but I can't make it run.

Tutorial

But each time I try upload file I am getting below exception.

02-25 18:18:40.703: W/GLSActivity(1853): [anc] Status from wire: INVALID_KEY status: null
02-25 18:18:40.703: W/GLSActivity(1853): [anc] Status from wire: INVALID_KEY status: null
02-25 18:18:40.703: I/GLSUser(1853): GLS error: INVALID_KEY skypatel7@gmail.com oauth2:https://www.googleapis.com/auth/drive
02-25 18:18:40.710: W/GLSActivity(1853): [anc] Status from wire: Unknown status: UNKNOWN
02-25 18:18:40.710: W/System.err(24843): com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAuthIOException
02-25 18:18:40.718: W/System.err(24843):    at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential$RequestHandler.intercept(GoogleAccountCredential.java:224)
02-25 18:18:40.718: W/System.err(24843):    at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:859)
02-25 18:18:40.718: W/System.err(24843):    at com.google.api.client.googleapis.media.MediaHttpUploader.executeUploadInitiation(MediaHttpUploader.java:352)
02-25 18:18:40.718: W/System.err(24843):    at com.google.api.client.googleapis.media.MediaHttpUploader.upload(MediaHttpUploader.java:266)
02-25 18:18:40.718: W/System.err(24843):    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:408)
02-25 18:18:40.718: W/System.err(24843):    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:328)
02-25 18:18:40.718: W/System.err(24843):    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:449)
02-25 18:18:40.718: W/System.err(24843):    at com.skyproductivity.android.trackerdrive.MainActivity$1.run(MainActivity.java:116)
02-25 18:18:40.718: W/System.err(24843):    at java.lang.Thread.run(Thread.java:1019)
02-25 18:18:40.718: W/System.err(24843): Caused by: com.google.android.gms.auth.GoogleAuthException: Unknown
02-25 18:18:40.726: W/System.err(24843):    at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
02-25 18:18:40.726: W/System.err(24843):    at com.google.android.gms.Auth. GoogleAuthUtil.getToken(Unknown Source)
02-25 18:18:40.726: W/System.err(24843):    at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential.getToken(GoogleAccountCredential.java:192)
02-25 18:18:40.726: W/System.err(24843):    at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential$RequestHandler.intercept(GoogleAccountCredential.java:217)
02-25 18:18:40.726: W/System.err(24843):    ... 8 more

`

I have already spent more then 50 Hr searching this very error.

有帮助吗?

解决方案

Finally i drop idea of using google google drive api using google pay service.

I use java Api client for google drive.

In this method you need to use webview for authentication. refere below tutorial.

http://www.learn2crack.com/2014/01/android-google-oauth2.html

其他提示

I had this, I did everything right but still failed. Finally I created a new Project in Google Developers Console. In there I created everything again.

This is an old post. I am not sure you have got the answer or not. But here is my solution: This error is most probably due to the fact that there is some error in your Client Id for Android. On Android, a combination of the Android package name, and the SHA-1 fingerprint of the signing key is used to retrieve profile. There are following two solutions: 1) Check for any typo in package name. 2) There can be multiple Android keystore on your system and the key which was used to sign the APK might be different than the one you put in developers console. For ex: On Ubuntu, when you call

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore -list -v

There are two locations: /root/.android and /home/ubuntu/.android. Check for the SHA1 key one was used to sign the apk.

Thanks. I hope this helps.

Arpit

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top