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錯誤的圖像,鍵或值。 –