3

I'm trying to make use of the AWS S3 storage to store images for a mobile app, but I'm not able to compile my app. I have the .jar files in my libs directory. In the dependencies section of my build.gradle file I have:

dependencies {       
    compile "com.amazonaws.services.s3:1.6.1"
}

I've tried every combination I can think of. com.amazonaws.services.s3:1.6.1, com.amazonaws.services:s3:1.6.1, com.amazonaws:services:1.6.1...but I always get an error about that says Could not find com.amazonaws.services.s3:1.6.1. (with whatever I put on the compile line in the error).

I can't find anything about getting this SDK to work with Android Studio and don't really know enough about Gradle to know how to get it to work. Any suggestions? Anyone already have this working?

jmickela
  • 663
  • 1
  • 8
  • 17

3 Answers3

7

Let me mention an addition solution:

dependencies {
    compile 'com.amazonaws:aws-android-sdk-core:2.1.+'
    compile 'com.amazonaws:aws-android-sdk-s3:2.1.+'
    // ... and any other AWS libraries you want to include
}

You can get the specific library names to use from the SDK Setup Guide.

The advantage over jmickela's (accepted) answer is that you don't need to download the files yourself, and let Gradle handle it instead. The advantage over Krit's answer is that you can pick only the specific libraries you actually want to use (Krit's solution will download all AWS libraries).

The disadvantage of my solution in comparison with jmickela's is that you may end up with an older version of the libraries, at least for a while. For instance, right now you can download 2.1.7 on AWS's site, while Gradle gets 2.1.5.

rbp
  • 43,594
  • 3
  • 38
  • 31
3

I got another solution which may work in your case too.

I tried

dependencies {
  compile 'com.amazonaws:aws-java-sdk:+'
}

It worked.

Krit
  • 610
  • 1
  • 7
  • 18
2

Found an answer myself, leaving this here since the answer will never match search terms for this specific problem.

Follow the directions on the accepted answer here: Android Studio - Importing external Library/Jar

Like the post right below it says, you don't have to exit from Android Studio, just Build->Rebuild Project

Community
  • 1
  • 1
jmickela
  • 663
  • 1
  • 8
  • 17