如何使用我的Andr​​oid应用程序上传谷歌驱动器上的文件 [英] How to upload file on google drive using my android application

查看:170
本文介绍了如何使用我的Andr​​oid应用程序上传谷歌驱动器上的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始谷歌驱动器SDK 。我遵循的帖子里面描述的步骤。

但我面对的问题第3步:创建和配置的Andr​​oid项目

我找不到我的日食的选择,所以我添加的插件谷歌。安装插件后,Eclipse将给出错误,现在我们还更新我的SDK。在这样的情况更新我的SDK,但现在所有的项目给我的错误在日食。我不能运行任何项目。所以,我用我的旧的SDK回来了。

现在我还是坚持了这个如何创建项目为谷歌驱动器,以及如何将它集成。

我需要从我的Andr​​oid应用程序,以谷歌驱动器上传文件。

请帮我找到这个。

修改

现在我成功地创建项目无差错。但是,当我跑项目时,它给我以下错误。

 十一月12号至12号:05:08.788:E / AndroidRuntime(377):java.lang.NoClassDefFoundError的:com.google.api.client.googleapis.extensions.android.gms。 auth.GoogleAccountCredential
十一月12日至12日:05:08.788:E / AndroidRuntime(377):在com.rarenoice.screen.MainActivity.onCreate(MainActivity.java:42)
十一月12日至12日:05:08.788:E / AndroidRuntime(377):在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
十一月12日至12日:05:08.788:E / AndroidRuntime(377):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
十一月12日至12日:05:08.788:E / AndroidRuntime(377):在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
十一月12日至12日:05:08.788:E / AndroidRuntime(377):在android.app.ActivityThread.access $ 2300(ActivityThread.java:125)
十一月12日至12日:05:08.788:E / AndroidRuntime(377):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:2033)
十一月12日至12日:05:08.788:E / AndroidRuntime(377):在android.os.Handler.dispatchMessage(Handler.java:99)
十一月12日至12日:05:08.788:E / AndroidRuntime(377):在android.os.Looper.loop(Looper.java:123)
十一月12日至12日:05:08.788:E / AndroidRuntime(377):在android.app.ActivityThread.main(ActivityThread.java:4627)
十一月12日至12日:05:08.788:E / AndroidRuntime(377):在java.lang.reflect.Method.invokeNative(本机方法)
十一月12日至12日:05:08.788:E / AndroidRuntime(377):在java.lang.reflect.Method.invoke(Method.java:521)
十一月12日至12日:05:08.788:E / AndroidRuntime(377):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:868)
十一月12日至12日:05:08.788:E / AndroidRuntime(377):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
十一月12日至12日:05:08.788:E / AndroidRuntime(377):在dalvik.system.NativeStart.main(本机方法)
 

在以下行: -

 私人GoogleAccountCredential凭证;
 凭据= GoogleAccountCredential.usingOAuth2(MainActivity.this,
                DriveScopes.DRIVE);
 

解决方案

您需要添加的谷歌播放服务罐子到您的项目,如快速入门指南的第3步解释您正在关注。

您还可以观看这个视频,我经历的所有步骤打造为Android一样快速启动应用:的 http://www.youtube.com/watch?v=Ied1CjJ0iP0

I start with google drive sdk. I follows steps which describe in that post.

But I face problem in Step 3: Create and Configure an Android Project

I cant find options in my eclipse so I add plugins for google. After installation of plugins, Eclipse give errors and we now update my SDK also. So for that I update my SDK but now All projects giving me error in eclipse. I cant run any projects. So I use my old SDK back.

Now I stuck with this How to create Project for Google Drive and how to integrate it.

I need to upload file from my android application to Google Drive.

Please help me to find this.

EDIT

Now I successfully create project with error free. But when I run project it give me following errors.

 12-12 11:05:08.788: E/AndroidRuntime(377): java.lang.NoClassDefFoundError: com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential
12-12 11:05:08.788: E/AndroidRuntime(377):  at com.rarenoice.screen.MainActivity.onCreate(MainActivity.java:42)
12-12 11:05:08.788: E/AndroidRuntime(377):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-12 11:05:08.788: E/AndroidRuntime(377):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
12-12 11:05:08.788: E/AndroidRuntime(377):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
12-12 11:05:08.788: E/AndroidRuntime(377):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
12-12 11:05:08.788: E/AndroidRuntime(377):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
12-12 11:05:08.788: E/AndroidRuntime(377):  at android.os.Handler.dispatchMessage(Handler.java:99)
12-12 11:05:08.788: E/AndroidRuntime(377):  at android.os.Looper.loop(Looper.java:123)
12-12 11:05:08.788: E/AndroidRuntime(377):  at android.app.ActivityThread.main(ActivityThread.java:4627)
12-12 11:05:08.788: E/AndroidRuntime(377):  at java.lang.reflect.Method.invokeNative(Native Method)
12-12 11:05:08.788: E/AndroidRuntime(377):  at java.lang.reflect.Method.invoke(Method.java:521)
12-12 11:05:08.788: E/AndroidRuntime(377):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-12 11:05:08.788: E/AndroidRuntime(377):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-12 11:05:08.788: E/AndroidRuntime(377):  at dalvik.system.NativeStart.main(Native Method)

At Following line :-

private GoogleAccountCredential credential;
 credential = GoogleAccountCredential.usingOAuth2(MainActivity.this,
                DriveScopes.DRIVE);

解决方案

You need to add the Google Play Services jars to your project, as explained in Step 3 of the quickstart guide you are following.

You can also watch this video where I go through all the steps to build the same quickstart application for Android: http://www.youtube.com/watch?v=Ied1CjJ0iP0

这篇关于如何使用我的Andr​​oid应用程序上传谷歌驱动器上的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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