files.get和.getRequestFactory不能得到解决 [英] files.get and .getRequestFactory cannot be resolved

查看:255
本文介绍了files.get和.getRequestFactory不能得到解决的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过FILEID得到一个文件的元数据在我的谷歌驱动器,但我使用文件()运行到一些问题。获得 getRequestFactory()

I'm trying to get the metadata of a file in my Google Drive through the fileID but I'm running into some problems using files().get and getRequestFactory().

具体来说,我期待在并在样品上它显示行

Specifically I'm looking at this and on the sample it shows the line

文件文件= service.files()获得(FILEID).execute();

的Htt presponse RESP = service.getRequestFactory()buildGetRequest(新GenericUrl(file.getDownloadUrl()))执行();

我使用了这些:

import com.google.api.client.http.GenericUrl;
import com.google.api.client.http.HttpResponse;
import com.google.api.services.drive.model.File;

作为样本中规定,并加载了 com.google.apis:谷歌API服务驱动:V2-rev168-1.20.0 依赖。但它仍然是导致无法解析方法文件()无法解析法getRequestFactory()

as stated in the sample and loaded the com.google.apis:google-api-services-drive:v2-rev168-1.20.0 dependency. But it's still resulting in Cannot resolve method files() and Cannot resolve method getRequestFactory(),

任何人都可以阐明这一些轻?

Can anyone shed some light on this?

推荐答案

我最近我跑这些进口/依存关系没有问题的项目,尽量仔细检查你的情况

I have recently run my project with these imports / dependencies without problems, try to double-check your situation

import com.google.api.client.extensions.android.http.AndroidHttp;
import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential;
import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException;
import com.google.api.client.googleapis.json.GoogleJsonResponseException;
import com.google.api.client.http.FileContent;
import com.google.api.client.http.GenericUrl;
import com.google.api.client.json.gson.GsonFactory;
import com.google.api.services.drive.Drive;
import com.google.api.services.drive.DriveScopes;
import com.google.api.services.drive.model.File;
import com.google.api.services.drive.model.FileList;
import com.google.api.services.drive.model.ParentReference;

com.google.api.services.drive NEEDS
    com.google.apis:google-api-services-drive:v2-rev105-1.17.0-rc
com.google.api.client NEEDS
    com.google.api-client:google-api-client-android:1.20.0
com.google.api.client.json.gson NEEDS
   com.google.http-client:google-http-client-gson:1.20.0

该块以上从此 GitHub的测试/演示。欢迎您使用它(与REST替换GDAA referencies在MainActivity)。

The chunk above is pulled from this GitHub test / demo. You're welcome to use it (replace the GDAA referencies in MainActivity with 'REST').

好运

这篇关于files.get和.getRequestFactory不能得到解决的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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