【发布时间】:2018-03-31 04:30:23
【问题描述】:
我在 android 中使用 transferutility mehtod 从 amazon s3 存储桶下载图像。上传工作正常。但是在下载时,当图像在存储桶中且具有我提供的相同密钥时,它会给我一个错误。
E/error: com.amazonaws.services.s3.model.AmazonS3Exception: The specified key does not exist. (Service: Amazon S3; Status Code: 404; Error Code: NoSuchKey; Request ID: D1B5ACBA8389A6), S3 Extended Request ID: RnoeOgB1TC2AY7AZ+TiMK6C49yUpBcebX2wV0CA6Zy2kl20MTzq+Odo+PLLiBN4a=
我下载图片的代码是:
credentialsProvider();
TransferUtility transferUtility = new TransferUtility(s3Client, getApplicationContext());
file = new File(Environment.getExternalStorageDirectory().toString() + "/" + test_object.getImagesQuestions().get(i).getImageKey());
test_object.getImagesQuestions().get(i).setImage(file);
TransferObserver observer = transferUtility.download(
"BucketName", /* The bucket to upload to */
test_object.getImagesQuestions().get(i).getImageKey(), /* The key for the uploaded object */
test_object.getImagesQuestions().get(i).getImage() /* The file where the data to upload exists */
);
transferObserverListener(observer);
【问题讨论】:
-
在您获得 404 时,图像、键或值看起来有问题。
标签: android amazon-s3 amazon-cognito