如何在android上设置Google Drive API? [英] How to set up Google Drive API on android?

查看:491
本文介绍了如何在android上设置Google Drive API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图将Google Drive功能集成到我的应用程序中,但我无法使用任何内置功能,因此我认为我错过了一个步骤或者做了错误的操作。我遵循官方的Google Developers指南: https://developers.google.com/drive/ android / get-started
然而当我使用这段代码时,

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

它显示为红色。我注册了一个项目,但结果如何?它与我的应用程序如何集成?
任何人都可以帮忙,指导我完成这些步骤吗?

解决方案

你需要去你的 app / build.gradle 文件,然后将Google Play服务作为依赖项添加: compile'c​​om.google。 android.gms:play-services-drive:9.2.0'



然后重新同步Gradle,并且这些类应该可用。


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.

这篇关于如何在android上设置Google Drive API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆