亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

AWS S3上傳卡在等待狀態

AWS S3上傳卡在等待狀態

慕絲7291255 2021-05-12 13:13:12
我已經查看了有關此問題的幾個問題和答案,但是仍然無法上傳到S3存儲桶。我已經在應用程序標記中的清單中聲明了該服務。每個日志語句都返回正確的信息,但是狀態始終為WAITING,并且不會觸發任何傳輸偵聽器。我沒有收到任何錯誤,并且S3存儲桶仍然為空。我究竟做錯了什么?public void uploadStoredItems() {    TransferUtility transferUtility = TransferUtility.builder()            .context(AWSProvider.getInstance().getContext())            .awsConfiguration(AWSProvider.getInstance().getConfiguration())            .s3Client(new AmazonS3Client(AWSProvider.getInstance().getIdentityManager().getCredentialsProvider()))            .build();    try {        for (File csvFile : csvFiles) {            String filename = csvFile.getName(); //.substring(csvFile.getName().lastIndexOf('/') + 1);            Log.d(TAG, "This is the filename for upload: " + filename);            // FileReader reads text files in the default encoding.            String line = null;            FileReader fileReader = new FileReader(csvFile);            // Always wrap FileReader in BufferedReader.            BufferedReader bufferedReader = new BufferedReader(fileReader);            while ((line = bufferedReader.readLine()) != null) {                Log.d(TAG, "Here are the lines: " + line);            }            // Always close files.            bufferedReader.close();            TransferObserver uploadObserver = transferUtility.upload(filename, csvFile);            // Gets id of the transfer.            Log.d(TAG, "This is the bucket: " + uploadObserver.getBucket());            Log.d(TAG, "This is the state: " + uploadObserver.getState());            Log.d(TAG, "This is the id: " + uploadObserver.getId());
查看完整描述

1 回答

?
LEATH

TA貢獻1936條經驗 獲得超7個贊

事實證明,我必須聲明TransferUtility服務以與我調用它的服務正在運行的過程相同的方式運行:


<application


    ...


    <service

      android:name=".MainService"

      android:enabled="true"

      android:process=":main_service"

      android:stopWithTask="false" />

    <service

      android:name="com.amazonaws.mobileconnectors.s3.transferutility.TransferService"

      android:process=":main_service"

      android:enabled="true" />


    ...


</application>


查看完整回答
反對 回復 2021-05-26
  • 1 回答
  • 0 關注
  • 308 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號