简体   繁体   中英

AWS Identity Token Vending Machine - Android Code Error

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM