Front-End Web & Mobile

Understanding the JARs in the AWS SDK for Android

Why all the JARs?

The AWS SDK for Android contains a number of JARs. Some are specific for development, while others are meant for distribution. This post explains the purpose of each of the JARs, if a JAR has any dependencies, and how to include the right JARs in your Android application.

Development JARs

To simplify and aid development, we include JARs that are compiled with full debug symbols. We have two of these types of JARs in the SDK: aws-android-sdk-VERSION-debug.jar and aws-android-sdk-VERSION-ddb-mapper-debug.jar.

aws-android-sdk-VERSION-debug.jar
Contains all the classes, including third-party dependencies, necessary for debugging and using any of the SDK’s supported services. All code was compiled with the debug option and with all symbols retained. We utilize this JAR in all the samples we provide with the SDK.

aws-android-sdk-VERSION-ddb-mapper-debug.jar
Contains all the classes necessary to use the Amazon DynamoDB Object Mapper. Must be used with the aws-android-sdk-VERSION-debug.jar file. The code was compiled with the debug option on with all symbols retained. There are two versions of the DynamoDB Object Mapper, and this JAR contains both. The two mappers are distinguished by distinct package names. The first mapper abstracts the 2011-12-05 version of Amazon DynamoDB and has the package name com.amazonaws.services.dynamodb.datamodeling. The second mapper abstracts the 2012-08-10 version of Amazon DynamoDB and has the package name com.amazonaws.services.dynamodbv2.datamodeling. Note that the 2011-12-05 version of Amazon DynamoDB is deprecated; therefore, we recommend that you use the version two DynamoDB Object Mapper. The DynamoDB Mapper-User Preference sample included with the SDK uses this JAR and utilizes version two of the DynamoDB Object Mapper.

Distribution JARs

When you are ready to distribute your application, we provide two options. You can either include a single JAR, or include the core JAR along with the service JARs you use. Each of the JARs below was compiled without the debug option, keeping each JAR as small as possible. To see how you can further reduce the size of your .apk, see this blog post on Using ProGuard with the AWS SDK for Android.

Single, all-services JAR
aws-android-sdk-VERSION.jar
Contains all the classes, including third-party dependencies, for all supported AWS services.

Core and service JARs
aws-android-sdk-VERSION-core.jar
Contains all third-party dependencies and the base platform used to send to and process requests from AWS services. All individual service JARs depend on the classes present in this JAR.

aws-android-sdk-VERSION-core-no-third-party.jar
Contains the base platform used to send to and process requests from AWS services but does not contain any of the third-party dependencies. Use of this JAR requires the following third-party dependencies: Streaming API for XML (sjsxp.jar), Jackson Java JSON-processor (jackson-core.jar, jackson-mapper-asl.jar), Apache Commons Codec (commons-codec.jar), and Apache Commons Logging (commons-logging.jar). The supported and verified versions of these libraries are included in the SDK download. If you need to use different versions than those supplied, please understand that we cannot guarantee functionality of the SDK.

aws-android-sdk-VERSION-autoscaling.jar
Contains all the classes necessary to use Auto Scaling. Must be used with the aws-android-sdk-VERSION-core.jar file.

aws-android-sdk-VERSION-cloudwatch.jar
Contains all the classes necessary to use Amazon CloudWatch. Must be used with the aws-android-sdk-VERSION-core.jar file.

aws-android-sdk-VERSION-ddb.jar
Contains all the classes necessary to use Amazon DynamoDB. Must be used with the aws-android-sdk-VERSION-core.jar file. This JAR supports two versions of DynamoDB, 2011-12-05 and 2012-08-10. The two versions of DynamoDB are represented by distinct package names. The 2011-12-05 version is named com.amazonaws.services.dynamodb, and the 2012-08-10 version is named com.amazonaws.services.dynamodbv2. Note that the 2011-12-05 version of DynamoDB is deprecated but included for backward compatibility.

aws-android-sdk-VERSION-ec2.jar
Contains all the classes necessary to use Amazon EC2. Must be used with the aws-android-sdk-VERSION-core.jar file.

aws-android-sdk-VERSION-elb.jar
Contains all the classes necessary to use Elastic Load Balancing. Must be used with the aws-android-sdk-VERSION-core.jar file.

aws-android-sdk-VERSION-s3.jar
Contains all the classes necessary to use Amazon S3. Must be used with the aws-android-sdk-VERSION-core.jar file.

aws-android-sdk-VERSION-sdb.jar
Contains all the classes necessary to use Amazon SimpleDB. Must be used with the aws-android-sdk-VERSION-core.jar file.

aws-android-sdk-VERSION-ses.jar
Contains all the classes necessary to use Amazon SES. Must be used with the aws-android-sdk-VERSION-core.jar file.

aws-android-sdk-VERSION-sns.jar
Contains all the classes necessary to use Amazon SNS. Must be used with the aws-android-sdk-VERSION-core.jar file.

aws-android-sdk-VERSION-sqs.jar
Contains all the classes necessary to use Amazon SQS. Must be used with the aws-android-sdk-VERSION-core.jar file.

aws-android-sdk-VERSION-sts.jar
Contains all the classes necessary to use AWS Security Token Service (STS). Must be used with the aws-android-sdk-VERSION-core.jar file.

aws-android-sdk-VERSION-ddb-mapper.jar
Contains all the classes necessary to use the Amazon DynamoDB Object Mapper. Must be used with aws-android-sdk-VERSION-core.jar and aws-android-sdk-VERSION-ddb.jar files. There are two versions of the Amazon DynamoDB Object Mapper and this JAR contains both. The two mappers are distinguished by distinct package names. The first mapper abstracts the 2011-12-05 version of Amazon DynamoDB and has the package name com.amazonaws.services.dynamodb.datamodeling. The second mapper abstracts the 2012-08-10 version of Amazon DynamoDB and has the package name com.amazonaws.services.dynamodbv2.datamodeling. Note that the 2011-12-05 version of Amazon DynamoDB is deprecated; therefore, we recommend that you use the version two DynamoDB Object Mapper.

How to Include These JARs in an Application

The samples included with the SDK for Android are provided as standalone projects set up for you to try out. They all use the aws-android-sdk-VERSION-debug.jar file. All the samples can be imported into Eclipse. Additionally, the AWS Toolkit for Eclipse supports the SDK for Android as noted in this post. By default, the AWS Toolkit for Eclipse uses the aws-android-sdk-VERSION-debug.jar JAR file.

To use the SDK for Android with an existing application, follow these steps:

  • Create a libs directory within your Android project directory if one does not already exist.

    • Be sure to name the directory libs and NOT lib.
  • Copy either a bundled JAR for all services or the specific JARs for the services you wish to use. You have three options:

    1. Add aws-android-sdk-VERSION-debug.jar. This JAR creates the largest .apk, but allows for full stack traces during development.
    2. Add aws-android-sdk-VERSION.jar. This JAR creates a smaller .apk and a simple bundle when releasing your application.
    3. Add the aws-android-sdk-VERSION-core.jar plus the JARs for the individual services your project will use. This method creates the smallest .apk, but requires a more complicated setup.

      • Note that copying both bundled JARs and service JARs will cause errors.
  • In Eclipse, go to your project, select Properties -> Java Build Path -> Libraries and then click Add JARs. Then select the JARs you added to your libs directory.

Summary

We include these JARs in the SDK to help you make the best choice when developing and distributing your application. We hope this helps!