Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to read S3TransferUtility please check your setup or awsconfiguration.json file

I am a newbie using AWS sdk for video transfer.But i am getting the error "Failed to read S3TransferUtility please check your setup or awsconfiguration.json file". Here is my code.

In my manifest file i have

<service android:name="com.amazonaws.mobileconnectors.s3.transferutility.TransferService" android:enabled="true" />

In my oncreate i am doing this.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_upload_post);

    AWSMobileClient.getInstance().initialize(this).execute();

transferUtility =
                TransferUtility.builder()
                        .context(this)
                        .awsConfiguration(AWSMobileClient.getInstance().getConfiguration())
                        .s3Client(new AmazonS3Client(AWSMobileClient.getInstance().getCredentialsProvider()))
                        .build();

}

The exception comes at .build. I debugged the code and it picks up the config file located at in folder perfectly cause i can see the data in debug but i think the transferutility.TransferService is not running. Can someone please help. Thanx

like image 976
Syed Muhammad Oan Avatar asked Mar 16 '18 15:03

Syed Muhammad Oan


2 Answers

For some reason the auto generated "awsconfiguration" file doesn't include the most important section called "S3TransferUtility". So you have to add it manually. Your "awsconfiguration.json" file should look something like this:

{
  "UserAgent": "MobileHub/1.0",
  "Version": "1.0",
  "CredentialsProvider": {
"CognitoIdentity": {
  "Default": {
    "PoolId": "us-east-1:<RANDOM-GUID>",
    "Region": "us-east-1"
  }
}
  },
  "IdentityManager": {
    "Default": {}
  },
  "PinpointAnalytics": {
    "Default": {
      "AppId": "<UNIQUE ID>",
      "Region": "us-east-1"
    }
  },
  "PinpointTargeting": {
    "Default": {
      "Region": "us-east-1"
    }
  },
  "S3TransferUtility": {
    "Default": {
      "Bucket": "<YOUR BUCKET NAME>",
      "Region": "us-east-1"
    }
  }
}
like image 111
Aviram Fireberger Avatar answered Oct 05 '22 15:10

Aviram Fireberger


In my awsconfiguration.json i add below lines then it's started working

  "S3TransferUtility": {
    "Default": {
      "Bucket": "<YOUR BUCKET NAME>",
      "Region": "us-east-1"
    }
  }
like image 22
Gowthaman M Avatar answered Oct 05 '22 15:10

Gowthaman M