Amazon S3从Android应用程序上传图像,获取访问权限被拒绝错误

时间:2015-12-14 05:27:12

标签: android amazon-web-services amazon-s3

我正在将我的Android应用程序中的图像上载到 Aws S3

我在我的代码中添加了 COGNITO_POOL_ID BUCKET_NAME 等Credetials。

问题:

在将图片上传到S3 Bucket时,加载超过50%,然后在Logcat中显示以下错误消息。

请帮我解决这个问题。

12-14 10:50:00.366 19534-27351/com.knowledgeflex.amazondemo E/UploadTask: Access Denied (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied; Request ID: DBF63654656657)
12-14 10:50:00.466 19534-27211/com.knowledgeflex.amazondemo D/dalvikvm: GC_FOR_ALLOC freed 6928K, 60% free 5964K/14680K, paused 48ms, total 48ms
12-14 10:50:00.476 19534-19543/com.knowledgeflex.amazondemo W/CursorWrapperInner: Cursor finalized without prior close()
12-14 10:50:00.476 19534-19534/com.knowledgeflex.amazondemo E/UploadActivity: Error during upload: 11
12-14 10:50:00.476 19534-19534/com.knowledgeflex.amazondemo E/UploadActivity: java.lang.IllegalStateException: Transfer failed.
12-14 10:50:00.476 19534-19534/com.knowledgeflex.amazondemo E/UploadActivity:     at com.amazonaws.mobileconnectors.s3.transferutility.TransferObserver$TransferContentObserver.onChange(TransferObserver.java:219)
12-14 10:50:00.476 19534-19534/com.knowledgeflex.amazondemo E/UploadActivity:     at android.database.ContentObserver.onChange(ContentObserver.java:129)
12-14 10:50:00.476 19534-19534/com.knowledgeflex.amazondemo E/UploadActivity:     at android.database.ContentObserver$NotificationRunnable.run(ContentObserver.java:180)
12-14 10:50:00.476 19534-19534/com.knowledgeflex.amazondemo E/UploadActivity:     at android.os.Handler.handleCallback(Handler.java:733)
12-14 10:50:00.476 19534-19534/com.knowledgeflex.amazondemo E/UploadActivity:     at android.os.Handler.dispatchMessage(Handler.java:95)
12-14 10:50:00.476 19534-19534/com.knowledgeflex.amazondemo E/UploadActivity:     at android.os.Looper.loop(Looper.java:136)
12-14 10:50:00.476 19534-19534/com.knowledgeflex.amazondemo E/UploadActivity:     at android.app.ActivityThread.main(ActivityThread.java:5584)
12-14 10:50:00.476 19534-19534/com.knowledgeflex.amazondemo E/UploadActivity:     at java.lang.reflect.Method.invokeNative(Native Method)
12-14 10:50:00.476 19534-19534/com.knowledgeflex.amazondemo E/UploadActivity:     at java.lang.reflect.Method.invoke(Method.java:515)
12-14 10:50:00.476 19534-19534/com.knowledgeflex.amazondemo E/UploadActivity:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
12-14 10:50:00.476 19534-19534/com.knowledgeflex.amazondemo E/UploadActivity:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
12-14 10:50:00.476 19534-19534/com.knowledgeflex.amazondemo E/UploadActivity:     at dalvik.system.NativeStart.main(Native Method)

错误2:第二次重新启动应用程序

Unable to execute HTTP request: Write error: ssl=0x6c637630: I/O error during system call, Connection reset by peer
12-14 12:03:52.080 9063-9063/com.knowledgeflex.amazondemo E/UploadActivity: Error during upload: 1
12-14 12:03:52.080 9063-9063/com.knowledgeflex.amazondemo E/UploadActivity: java.lang.IllegalStateException: Transfer failed.
12-14 12:03:52.080 9063-9063/com.knowledgeflex.amazondemo E/UploadActivity:     at com.amazonaws.mobileconnectors.s3.transferutility.TransferObserver$TransferContentObserver.onChange(TransferObserver.java:219)
12-14 12:03:52.080 9063-9063/com.knowledgeflex.amazondemo E/UploadActivity:     at android.database.ContentObserver.onChange(ContentObserver.java:129)
12-14 12:03:52.080 9063-9063/com.knowledgeflex.amazondemo E/UploadActivity:     at android.database.ContentObserver$NotificationRunnable.run(ContentObserver.java:180)
12-14 12:03:52.080 9063-9063/com.knowledgeflex.amazondemo E/UploadActivity:     at android.os.Handler.handleCallback(Handler.java:733)
12-14 12:03:52.080 9063-9063/com.knowledgeflex.amazondemo E/UploadActivity:     at android.os.Handler.dispatchMessage(Handler.java:95)
12-14 12:03:52.080 9063-9063/com.knowledgeflex.amazondemo E/UploadActivity:     at android.os.Looper.loop(Looper.java:136)
12-14 12:03:52.080 9063-9063/com.knowledgeflex.amazondemo E/UploadActivity:     at android.app.ActivityThread.main(ActivityThread.java:5584)
12-14 12:03:52.080 9063-9063/com.knowledgeflex.amazondemo E/UploadActivity:     at java.lang.reflect.Method.invokeNative(Native Method)
12-14 12:03:52.080 9063-9063/com.knowledgeflex.amazondemo E/UploadActivity:     at java.lang.reflect.Method.invoke(Method.java:515)
12-14 12:03:52.080 9063-9063/com.knowledgeflex.amazondemo E/UploadActivity:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
12-14 12:03:52.080 9063-9063/com.knowledgeflex.amazondemo E/UploadActivity:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
12-14 12:03:52.080 9063-9063/com.knowledgeflex.amazondemo E/UploadActivity:     at dalvik.system.NativeStart.main(Native Method)

0 个答案:

没有答案