title: Can't load Amazon Web Service (AWS) S3 libraries on Android Studio
body: <p>Well, I've just tried to include AWS library in Android Studio. I was trying to send data to my S3 server from my mobile app, but I couldn't.</p>
  
  <p>This is the build.gradle (app):</p>
  
  <pre><code>dependencies {
      ...
      compile (group: 'com.amazonaws', name: 'aws-java-sdk', version: '1.11.257'){ transitive = true }
      ...
  }
  </code></pre>
  
  <p>This is the AndroidManifest.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="..."&gt;
      &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt;
      ...
      &lt;application ...&gt;
          ...
      &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>
  
  <p>This is an Activity.java:</p>
  
  <pre><code>package ...;
  ...
  import com.amazonaws.auth.AWSStaticCredentialsProvider;
  import com.amazonaws.auth.BasicAWSCredentials;
  import com.amazonaws.services.s3.AmazonS3Client;
  import com.orhanobut.logger.Logger;
  import com.amazonaws.AmazonClientException;
  import com.amazonaws.AmazonServiceException;
  import com.amazonaws.services.s3.AmazonS3;
  import com.amazonaws.services.s3.model.PutObjectRequest;
  ...
  public class Activity extends AppCompatActivity
  {
      ...
      public void sendData(View v)
      {
          AmazonS3 s3client;
          File file;
          final String bucketName     = "************************";
          final String keyName        = "********************";
          final String secretKey      = "****************************************";
  
          try
          {
              file = new File(uri.getPath());
              s3client = AmazonS3ClientBuilder.standard().withCredentials(
                  new AWSStaticCredentialsProvider
                  (
                      new BasicAWSCredentials(keyName, secretKey)
                  )
              ).build();
              s3client.putObject(new PutObjectRequest(bucketName, keyName, file));//~ */
          }
          catch (NoClassDefFoundError|IllegalStateException|IllegalArgumentException ex)
          {
              ex.printStackTrace();
          }
          catch (AmazonServiceException ase)
          {
              StringBuilder str_builder_error_mensaje = new StringBuilder("");
  
              ase.printStackTrace();
              str_builder_error_mensaje.append("Caught an AmazonServiceException, which means your request made it to Amazon S3, but was rejected with an error response for some reason.");
              str_builder_error_mensaje.append("\nError Message:    ").append(ase.getMessage());
              str_builder_error_mensaje.append("\nHTTP Status Code: ").append(ase.getStatusCode());
              str_builder_error_mensaje.append("\nAWS Error Code:   ").append(ase.getErrorCode());
              str_builder_error_mensaje.append("\nError Type:       ").append(ase.getErrorType().name());
              str_builder_error_mensaje.append("\nRequest ID:       ").append(ase.getRequestId());
              Logger.d(str_builder_error_mensaje.toString());
          }
          catch (AmazonClientException ace)
          {
              StringBuilder str_builder_error_mensaje = new StringBuilder("");
  
              ace.printStackTrace();
              str_builder_error_mensaje.append("Caught an AmazonClientException, which means the client encountered an internal error while trying to communicate with S3, such as not being able to access the network.");
              str_builder_error_mensaje.append("\nError Message:    ").append(ace.getMessage());
              Logger.d(str_builder_error_mensaje.toString());
          }
      }
      ...
  }
  </code></pre>
  
  <p>Then I get this error message when I execute it on the emulator:</p>
  
  <pre><code>W/System.err: java.lang.NoClassDefFoundError: com.amazonaws.services.s3.AmazonS3Client
  W/System.err:     at com.amazonaws.services.s3.AmazonS3Builder$1.apply(AmazonS3Builder.java:35)
  W/System.err:     at com.amazonaws.services.s3.AmazonS3Builder$1.apply(AmazonS3Builder.java:32)
  W/System.err:     at com.amazonaws.services.s3.AmazonS3ClientBuilder.build(AmazonS3ClientBuilder.java:64)
  </code></pre>
  
  <p>I haven't been able to load the library of AWS in Android Studio.</p>