AWS Identity Token Vending Machine - Android Code Error

446 views Asked by At

I am using;

  • Eclipse Juno
  • ADT-22.3.0
  • aws-android-sdk-1.7.0

For using AWS Token Vending machine code I used sample code for android from below link; http://aws.amazon.com/code/4598681430241367

As per instructions I added following libs to project classpath;

  • aws-android-sdk-1.7.0-debug.jar
  • aws-android-sdk-1.7.0.jar

and when I run in emulator and device; I receive following error at runtime (no error at compile time)

 java.lang.NoClassDefFoundError: com.amazonaws.util.DateUtils
    at com.amazonaws.tvmclient.Utilities.getTimestamp(Utilities.java:28)
    at com.amazonaws.tvmclient.LoginRequest.buildRequestUrl(LoginRequest.java:50)
....

However, in code when I checked - the class is imported and there are no compile time errors

import com.amazonaws.util.DateUtils;

and here how it is used in code (Utilities class sample code);

new DateUtils().formatIso8601Date( new Date() );

would appreciate any pointers

2

There are 2 answers

0
Bob Kinney On BEST ANSWER

You may need to update the Eclipse project settings to ensure all classes are exported for Dexing. Please take a look at the instructions at the following blog post and see if this solves your issue:

Running AWS SDK for Android samples in Eclipse with ADT v22

0
Prabhu M On

Dont add both

  1. aws-android-sdk-1.7.0-debug.jar
  2. aws-android-sdk-1.7.0.jar

into your classpath. During run time, it creates conflict regarding class files because both the jars have class files with common name.

Either use aws-android-sdk-1.7.0-debug.jar which creates the largest APK, but allows for full stack traces during development. or

Add aws-android-sdk-VERSION.jar which creates a smaller APK and a simple bundle when releasing your application.