Group Group Group Group Group Group Group Group Group Forums

Integrating Google Drive in Android

See how to integrate the Google Drive SDK in order to let your users access and download their Drive files directly to your app.

This is a companion discussion topic for the original entry at

Thanks for the article, but I really don’t understand all this Kotlin focus. Generally those who use Kotlin are mostly switchers from Java and would understand the Java-focused lesson. But those sticking to Java are left ignored.

Don’t get me wrong, I do appreciate the wealth of info this dite gives. Yet I’m a bit disappointed

Thanks for the feedback, Roman. It seems that the Android community generally is moving in the direction of Kotlin, especially now that the language has official support from Google. We find the Kotlin syntax and idioms to be especially fun and refreshing to program with, so we’ve decided to put our focus there for now.

But we take your feedback to heart, and will continue to evaluate this decision as time goes by. Thanks again!

I think if you are familiar with Java to get familiar with basic Kotlin to understand tutorial like this one takes around 1 hour. Especially because it focuses on Android and not language.

Hello … Is it possible to download multiple files from Google drive using the above code

@kevindmoore Can you please help with this when you get a chance? Thank you - much appreciated! :]

Unfortunately, there is currently no way to choose multiple files at once. If you need this functionality, I would encourage you to ask Google to implement it.

I tried this app but I’m getting a Sign-in failure (getAccountTask.exception): 16:

Any ideas as to what might be wrong?

Can you post a full stack trace? Also, can you describe the steps you’ve taken so far?

Sure. But it’s not an app crash. Its a sign-in failure so there really isn’t a stack trace.

GoogleDriveService.handleSignIn is NOT successful.

getAccountTask.zzagh = 16:
.zzagf = true
.zzagh = null
.zzfi = false

I created a Google Console project with Android credentials.
When I try to login it just fails to login.

I am trying to run this on a windows simulation of a Pixel 3 API 28.
play services version 15.0.1
support version 26.1.0
compileSDK 26
minSDK 25

Here are some things to check.
Make sure you have this in your manifest file:

    android:value="@integer/google_play_services_version" />

Did you follow the keytool section exactly? I would review this section to make sure that Google’s setup is correct.

meta-data … yep exactly

keytool section … not exactly because Console Credentials won’t let me use GoogleDriveDemo for product name (says it implies it is a Google app and that’s a no-no) So I used GDriveDemo.

I guess my next step would be to try this on a real device. I’ve had some problems with simulators in the past.

Heh. Google Signing hell. When I switched to a real device I got a nearly identical error only instead of 16 it was 12500.

It seems like a signing issue so I looked for that error and I found:

I used a combination of the green check answer and a bit below that the answer from alexshr. Which gave me a different debug SHA1. I added a new Android Client to my console with that SHA 1 to my project and it worked.

Note that this method allowed me to create a SHA 1 key without having to manually run keytool in a command shell. Pus anytime I want the release key (I think) it’ll be right there under (root).

So the debug demo is running now. Thanks for your tutorial. I’m needing this for at least 2 projects I’d like to get to.

Wow, good work on figuring this out. Hopefully this will help others as well.

Hi guys, i need some help. I downloaded the materials from the link provided at the bottom of the page and installed the apk into my phone. After opening the app, I clicked on log in and selected my account. I got the following error when i click on my account, “we found a problem: sign-in failed”. Can someone help me? Thanks

Did you go through the steps to register on Google’s console and downloading the newly created JSON file?

Thanks a lot for a great article. I followed the steps and managed to have it working.
My next step is integrating it into an Android app public available. As part of the process, it is necessary to create an OAuth Consent Screen for the authentication. Since my app access only Google Drive and no other external domains I fill the form (in Google Cloud Console -> APIs -> Credentials ) as follows:

But I get the following error and don’t manage to submit it for verification:
"Invalid domain: URL must be hosted on a domain listed in the “Authorized domains” section. "

Did someone manage to deploy Google Drive integration into a production Android App?


I originally wrote this for my company and it is in production

Hi Kevin,

Thanks for your update. Not sure if I understand. I believe that you followed the steps that you wrote and the app is in production. My app too, but I was wondering about the following (from Google) to prevent users seeing a warning:

" OAuth Developer Verification

To protect you and your users, your consent screen may need to be verified by Google. Without verification, your users will see an additional page indicating that your app is not verified by Google. Learn more

Verification is required if:

  • Your application type is public, and"

So, this verification process wouldn’t be necessary ?