Front-End Web & Mobile

DEX method count reduced by another 40% in the AWS Mobile SDK for Android

In February, we announced a 40% reduction in the DEX method count for the AWS Mobile SDK for AndroidTM. Since then, we have continued to optimize the SDK further so you can avoid hitting the maximum limit of 65K DEX methods imposed by Android.

On 4/9/2015, we released version 2.2.0 that achieves another 40% reduction (a ~70% reduction year-to-date) in the DEX method count for the AWS Mobile SDK for Android bringing the overall method count in the core SDK to only 4,400.

We achieved this by replacing the Apache HTTP Client 4.2 with the HttpURLConnection library that is recommended for Android. Prior to version 2.2.0, the AWS Mobile SDK for Android bundled the Apache HttpClient 4.2 as it was more stable than the Apache HttpClient built-in to Android. With the migration to HttpURLConnection, a general-purpose and lightweight alternative, the SDK no longer requires inclusion of the Apache HttpClient library.

To recap, in version 2.1.9, we had made the following updates to reduce the DEX method count:

  1. Replaced Jackson with Gson. Gson is a library that performs conversions between Java objects and the equivalent JSON representation. Gson offers functionality and performance similar to that of Jackson, but it is lightweight by comparison.
  2. Used Java’s SimpleDateFormat instead of Joda. The AWS Mobile SDK for Android used Joda to convert between date Strings and Date objects. This has now been replaced with the lighter-weight SimpleDateFormat, with ThreadLocal used to resolve any thread safety issues.
  3. Replaced the Java StAX XML parser with Android’s XmlPullParser. Prior to v2.1.8, the AWS SDK for Android used StAX to parse XML encoded content, requiring the additional inclusion of Jaxp-api 1.4.4 and sjsxp 1.0.2. We have now re-written the XML unmarshaller with the XML parser built-in to Android,XmlPullParser.

The latest version of the AWS Mobile SDK for Android is available via:

If you have any questions, issues, or ideas, you can provide feedback here.

Android is a trademark of Google Inc.