0
我在android中使用transferutility mehtod从亚马逊s3存储桶下载图像。上传工作正常。但是在下载时,它给我一个错误,同时图像与我提供的相同密钥在存储桶中。无法从android s3中通过TransferUtility获取图像android
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错误的图像,键或值。 –