avegrv / google-drive-api-sample

This is sample based on Google Drive API. Simple use case - using Google Drive to backup and restore SQLite Database.
12 stars 6 forks source link

Error upload #1

Closed appsgardenbd closed 3 years ago

appsgardenbd commented 5 years ago

This message appear when save button clicked, (already signed in to drive or auth success)

avegrv commented 4 years ago

@appsgardenbd Please, provide adb logcat output. I have installed the app and checked on my emulator, everything is ok.

VladimirZhdanov commented 3 years ago

The same error(tested on real phone - samsung S10 lite Android 10): 2020-12-04 09:51:10.653 23748-10183/com.j002e3.sample.google.drive V/Toast: HIDE: android.widget.Toast$TN@faeb0d7 2020-12-04 09:51:10.654 23748-23748/com.j002e3.sample.google.drive V/Toast: HANDLE HIDE: android.widget.Toast$TN@faeb0d7 mView=android.widget.LinearLayout{48cfdc4 V.E...... ........ 0,0-476,116} 2020-12-04 09:51:10.654 23748-23748/com.j002e3.sample.google.drive V/Toast: REMOVE! android.widget.LinearLayout{48cfdc4 V.E...... ........ 0,0-476,116} in android.widget.Toast$TN@faeb0d7 2020-12-04 09:51:10.657 23748-10343/com.j002e3.sample.google.drive D/OpenGLRenderer: destroyEglSurface : 0x6ffbd9fe00 2020-12-04 09:51:10.658 23748-10343/com.j002e3.sample.google.drive D/OpenGLRenderer: ~ReliableSurface : 0x6ffbee0900 2020-12-04 09:51:10.659 23748-23748/com.j002e3.sample.google.drive I/ViewRootImpl@1c38373[Toast]: dispatchDetachedFromWindow 2020-12-04 09:51:10.679 23748-23748/com.j002e3.sample.google.drive D/InputTransport: Input channel destroyed: 'ac170d7', fd=75 2020-12-04 09:51:11.191 23748-23748/com.j002e3.sample.google.drive I/ViewRootImpl@b7a5c7e[MainActivity]: ViewPostIme pointer 0 2020-12-04 09:51:11.290 23748-23748/com.j002e3.sample.google.drive I/ViewRootImpl@b7a5c7e[MainActivity]: ViewPostIme pointer 1 2020-12-04 09:51:14.140 23748-23748/com.j002e3.sample.google.drive I/ViewRootImpl@b7a5c7e[MainActivity]: ViewPostIme pointer 0 2020-12-04 09:51:14.229 23748-23748/com.j002e3.sample.google.drive I/ViewRootImpl@b7a5c7e[MainActivity]: ViewPostIme pointer 1 2020-12-04 09:51:14.295 23748-23748/com.j002e3.sample.google.drive D/Toast: show: focusDisplayId = 0, isFocusInDesktop = false mCustomDisplayId=-1 2020-12-04 09:51:14.300 23748-10183/com.j002e3.sample.google.drive V/Toast: SHOW: android.widget.Toast$TN@ccb1419 2020-12-04 09:51:14.300 23748-23748/com.j002e3.sample.google.drive V/Toast: HANDLE SHOW: android.widget.Toast$TN@ccb1419 mView=null mNextView=android.widget.LinearLayout{6ed5cde V.E...... ......I. 0,0-0,0} 2020-12-04 09:51:14.300 23748-23748/com.j002e3.sample.google.drive V/Toast: HANDLE HIDE: android.widget.Toast$TN@ccb1419 mView=null 2020-12-04 09:51:14.307 23748-23748/com.j002e3.sample.google.drive I/ViewRootImpl@56fd8d5[Toast]: setView = android.widget.LinearLayout@6ed5cde TM=true MM=false 2020-12-04 09:51:14.307 23748-23748/com.j002e3.sample.google.drive V/Toast: Text: Frro in android.widget.Toast$TN@ccb1419 2020-12-04 09:51:14.316 23748-23748/com.j002e3.sample.google.drive I/ViewRootImpl@56fd8d5[Toast]: Relayout returned: old=(0,93,1080,2361) new=(364,2077,716,2193) req=(352,116)0 dur=6 res=0x7 s={true 480942981120} ch=true 2020-12-04 09:51:14.317 23748-10343/com.j002e3.sample.google.drive D/OpenGLRenderer: createReliableSurface : 0x6ffa70a1c0(0x6ffa6f8000) 2020-12-04 09:51:14.317 23748-10343/com.j002e3.sample.google.drive D/OpenGLRenderer: eglCreateWindowSurface : 0x6ffbdca980 2020-12-04 09:51:14.318 23748-10343/com.j002e3.sample.google.drive D/OpenGLRenderer: makeCurrent EglSurface : 0x6ffbd9f900 -> 0x6ffbdca980 2020-12-04 09:51:14.320 23748-10343/com.j002e3.sample.google.drive D/OpenGLRenderer: makeCurrent EglSurface : 0x6ffbdca980 -> 0x6ffbd9f900 2020-12-04 09:51:14.327 23748-23748/com.j002e3.sample.google.drive I/ViewRootImpl@56fd8d5[Toast]: MSG_RESIZED: frame=(364,2077,716,2193) ci=(0,0,0,0) vi=(0,0,352,116) or=1

avegrv commented 3 years ago

Ok, it is line number 73 in MainActivity, onError callback.

@VladimirZhdanov Please log the exception in the Log.e function and provide the output.

Stillhard commented 3 years ago

I think the problem is here: com.google.android.gms.common.api.ApiException: 17: API: Drive.API_CONNECTIONLESS is not available on this device.

avegrv commented 3 years ago

Try the following instructions: go to the dashboard and enable the google drive API. Hope that helps. And I will try to update the project to the new API.

Stillhard commented 3 years ago

Try the following instructions: go to the dashboard and enable the google drive API. Hope that helps

It's already enabled.

FYI, to show the consent permission, i replaced these lines with: https://github.com/avegrv/google-drive-api-sample/blob/422850a994e7d15ec5ca587cb79f2af680794d64/app/src/main/java/com/j002e3/sample/google/drive/google/GoogleDriveActivity.java#L33

return new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestScopes(new Scope("https://www.googleapis.com/auth/drive.file")) .requestScopes(new Scope(Scopes.DRIVE_FILE)) .build();

Is the scope 'APPFOLDER' needed? .requestScopes(new Scope(Scopes.DRIVE_APPFOLDER))

And I will try to update the project to the new API.

Nice to know that, I'll try to help as much as I can.

avegrv commented 3 years ago

@Stillhard I have updated this repo. Try with the latest master revision. I have migrated to a new API and updated app dependencies.

Stillhard commented 3 years ago

@Stillhard I have updated this repo. Try with the latest master revision. I have migrated to a new API and updated app dependencies.

OK, I'll get back to you with the report

Stillhard commented 3 years ago

Here's the report @avegrv

photo_2021-01-11_19-39-54

2021-01-11 19:35:48.376 32053-32053/com.sample.google.drive E/MainActivity: error upload file com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential$RequestHandler.intercept(GoogleAccountCredential.java:297) at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:868) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:476) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:409) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:526) at com.sample.google.drive.google.GoogleDriveApiDataRepository.lambda$createFile$5$GoogleDriveApiDataRepository(GoogleDriveApiDataRepository.java:124) at com.sample.google.drive.google.-$$Lambda$GoogleDriveApiDataRepository$3pIxHFJqPM9iMVYFazgjDLChDzg.call(lambda) at com.google.android.gms.tasks.zzv.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:761) Caused by: com.google.android.gms.auth.UserRecoverableAuthException: NeedPermission at com.google.android.gms.auth.zze.zzb(Unknown Source) at com.google.android.gms.auth.zzd.zza(Unknown Source) at com.google.android.gms.auth.zzd.zzb(Unknown Source) at com.google.android.gms.auth.zzd.getToken(Unknown Source) at com.google.android.gms.auth.zzd.getToken(Unknown Source) at com.google.android.gms.auth.zzd.getToken(Unknown Source) at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source) at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential.getToken(GoogleAccountCredential.java:267) at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential$RequestHandler.intercept(GoogleAccountCredential.java:292) at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:868)  at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:476)  at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:409)  at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:526)  at com.sample.google.drive.google.GoogleDriveApiDataRepository.lambda$createFile$5$GoogleDriveApiDataRepository(GoogleDriveApiDataRepository.java:124)  at com.sample.google.drive.google.-$$Lambda$GoogleDriveApiDataRepository$3pIxHFJqPM9iMVYFazgjDLChDzg.call(lambda)  at com.google.android.gms.tasks.zzv.run(Unknown Source)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)  at java.lang.Thread.run(Thread.java:761) 

avegrv commented 3 years ago

@Stillhard Opened new issue