Android google驱动器快速启动示例上传图片失败

时间:2013-03-21 07:35:32

标签: android google-drive-api

我使用此快速启动示例https://developers.google.com/drive/quickstart-android

Logcat显示

03-21 14:44:36.213: E/AndroidRuntime(26394): FATAL EXCEPTION: Thread-1867
03-21 14:44:36.213: E/AndroidRuntime(26394): java.lang.NullPointerException
03-21 14:44:36.213: E/AndroidRuntime(26394):    at java.net.URI.parseURI(URI.java:353)
03-21 14:44:36.213: E/AndroidRuntime(26394):    at java.net.URI.<init>(URI.java:204)
03-21 14:44:36.213: E/AndroidRuntime(26394):    at com.google.api.client.http.GenericUrl.<init>(GenericUrl.java:100)
03-21 14:44:36.213: E/AndroidRuntime(26394):    at com.google.api.client.googleapis.media.MediaHttpUploader.upload(MediaHttpUploader.java:269)
03-21 14:44:36.213: E/AndroidRuntime(26394):    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:408)
03-21 14:44:36.213: E/AndroidRuntime(26394):    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:328)
03-21 14:44:36.213: E/AndroidRuntime(26394):    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:449)
03-21 14:44:36.213: E/AndroidRuntime(26394):    at com.mysample.google.GoogleDrive$1.run(GoogleDrive.java:161)
03-21 14:44:36.213: E/AndroidRuntime(26394):    at java.lang.Thread.run(Thread.java:856)

GoogleDrive.java:161是

File file = service.files().insert(body, mediaContent).execute();

我已在Google API控制台上启用了Drive API和Drive SDK。 我还在AndroidManifest.xml

添加了这些行
<meta-data android:name="com.google.android.apps.drive.APP_ID" android:value="id=MY_APP_ID" />
<intent-filter>
    <action android:name="android.intent.action.GoogleDrive" />
    <data android:mimeType="image/png" />
    <data android:mimeType="image/jpeg" />
    <data android:mimeType="image/jpg" />
    <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

感谢您的帮助。

0 个答案:

没有答案