Syed Muhammad Oan
Syed Muhammad Oan

Reputation: 697

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

Upvotes: 7

Views: 6717

Answers (3)

Gowthaman M
Gowthaman M

Reputation: 8272

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

  "S3TransferUtility": {
    "Default": {
      "Bucket": "<YOUR BUCKET NAME>",
      "Region": "us-east-1"
    }
  }

Upvotes: 6

Aviram Fireberger
Aviram Fireberger

Reputation: 4168

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"
    }
  }
}

Upvotes: 7

Lucas Rufino
Lucas Rufino

Reputation: 71

Add awsconfiguration.json on your project and change pool id and region attributes. You can read more about it here.

Upvotes: 5

Related Questions