简体   繁体   中英

How to set up Google Drive API on android?

I have been attempting to integrate Google Drive functionality within my application but I am not able to use any of the built-in functions therefore I believe I either missed a step or did it incorrectly. I am following the official Google Developers guide: https://developers.google.com/drive/android/get-started Yet when I use this code,

  mGoogleApiClient = new GoogleApiClient.Builder(this)
            .addApi(Drive.API)
            .addScope(Drive.SCOPE_FILE)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .build();

it displays as red. I registered a project but what do I do with the result, how is it integrated with my application? Can anyone help, guide me through the steps?

You need to go to your app/build.gradle file and add Google Play Services as a dependency:

compile 'com.google.android.gms:play-services-drive:9.2.0'

Then resync Gradle and those classes should be available.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM