Google Drive via OAuth release version receives dailyLimitExceededUnreg

后端 未结 1 1638
遥遥无期
遥遥无期 2021-01-26 17:11

I simply cannot get my way past this one. The error and related searches do nothing to fix it.

I\'m coming from the Drive Android API which was working fine. Google in e

相关标签:
1条回答
  • 2021-01-26 17:44

    Frustrated and still throwing things at it but tracked it down to ProGuard causing the problem during creation of signed apk.

    Why can't Google get this stuff straight in the docs....


    Edit

    Key, token, etc isn't needed using Drive Rest API and OAuth...

    With, ProGuard in use, just need to use maybe one or two or all three of the following. I'm too frustrated at the moment to narrow it down more:

    -keep class * extends com.google.api.client.json.GenericJson { *; }
    -keep class com.google.api.services.drive.** { *; }
    -keepclassmembers class * { @com.google.api.client.util.Key <fields>; }
    

    The error isn't listed in the link for example so it doesn't pop up in search results: Google Drive Api v3 and proguard (I added one extra)

    What I have that works is:

    1) Using a cloud console provided project # in manifest with meta-data and intent-filter. https://developers.google.com/drive/android/java-client#set_mime_types_in_the_app_manifest

    2) The gradle stuff for Drive. I have this listed for that:

    // GOOGLE DRIVE API (as of 6/22/19)
    implementation 'com.google.http-client:google-http-client-gson:1.26.0'
    implementation('com.google.api-client:google-api-client-android:1.26.0') {
        exclude group: 'org.apache.httpcomponents'
    }
    implementation('com.google.apis:google-api-services-drive:v3-rev136-1.25.0') {
        exclude group: 'org.apache.httpcomponents'
    }
    

    3) And the Drive rest API examples found from Google for sign-in, file upload, download, deletion, etc. etc. that don't included keys or token use (though done my way). https://developers.google.com/drive/android/auth eg sign-in. https://github.com/gsuitedevs/android-samples/blob/master/drive/deprecation/app/src/main/java/com/google/android/gms/drive/sample/driveapimigration/DriveServiceHelper.java eg creating files, etc.

    4) Cloud console OAuth screen (verified - when you verify Google will tell you if something is wrong as they help you to gain verification) and credentials along with Drive API enabled. For credentials: https://developers.google.com/drive/android/auth eg OAuth client ID with Android selected (if you already have that then no need to change).

    5) The ProGuard fix

    And I think that was it. There's stuff all over the place (including other things that I'm not getting into) but that's Google for you. Stupidly complex just to use Drive again when it was fine already lol.

    Also note that you may have serious code changes ahead of you as well for those switching from Drive Android API. See the file creation, etc link above for why it may be different than it was with Android Drive API. I did the long haul of changing all the code which was substantial including bug fixing and testing as I couldn't find a way to keep it the same. A fun time that was. As a result though I fixed some problems and improved things that I didn't see or wanted to do anyway so that was about the only good thing there =) I smile here but will never be happy about what Google did here and don't think you will be either.

    Solved!

    0 讨论(0)
提交回复
热议问题