0

I have imported the S3Uploader example in my eclipse (ADT eclipse) and i am trying to run it.

I have imported the proeject and then added following jars Project > Properties > java build path > add jars

02/02/2014 01:24 PM 6,376,630 aws-android-sdk-1.7.1.1-debug.jar 02/02/2014 01:14 PM 281,550 aws-android-sdk-1.7.1.1-s3.jar 02/02/2014 01:24 PM 5,587,005 aws-android-sdk-1.7.1.1.jar

project compiles and builds fine.But when i run it it gives following exception

02-02 13:39:03.151: E/dalvikvm(20716): Could not find class 'com.amazonaws.services.s3.AmazonS3Client', referenced from method com.amazonaws.demo.s3uploader.S3UploaderActivity.<init>
02-02 13:39:03.151: W/dalvikvm(20716): VFY: unable to resolve new-instance 40 (Lcom/amazonaws/services/s3/AmazonS3Client;) in Lcom/amazonaws/demo/s3uploader/S3UploaderActivity;
02-02 13:39:03.151: D/dalvikvm(20716): VFY: replacing opcode 0x22 at 0x0004
02-02 13:39:03.151: D/dalvikvm(20716): VFY: dead code 0x0006-0018 in Lcom/amazonaws/demo/s3uploader/S3UploaderActivity;.<init> ()V
02-02 13:39:03.161: W/dalvikvm(20716): VFY: unable to find class referenced in signature (Lcom/amazonaws/services/s3/AmazonS3Client;)
02-02 13:39:03.161: W/dalvikvm(20716): VFY: unable to resolve static field 33 (US_WEST_2) in Lcom/amazonaws/regions/Regions;
02-02 13:39:03.161: D/dalvikvm(20716): VFY: replacing opcode 0x62 at 0x0005
02-02 13:39:03.161: D/dalvikvm(20716): VFY: dead code 0x0007-003c in Lcom/amazonaws/demo/s3uploader/S3UploaderActivity;.onCreate (Landroid/os/Bundle;)V
02-02 13:39:03.161: D/AndroidRuntime(20716): Shutting down VM
02-02 13:39:03.161: W/dalvikvm(20716): threadid=1: thread exiting with uncaught exception (group=0x4001d5a0)
02-02 13:39:03.161: E/AndroidRuntime(20716): FATAL EXCEPTION: main
02-02 13:39:03.161: E/AndroidRuntime(20716): java.lang.NoClassDefFoundError: com.amazonaws.services.s3.AmazonS3Client
02-02 13:39:03.161: E/AndroidRuntime(20716):    at com.amazonaws.demo.s3uploader.S3UploaderActivity.<init>(S3UploaderActivity.java:45)
02-02 13:39:03.161: E/AndroidRuntime(20716):    at java.lang.Class.newInstanceImpl(Native Method)
02-02 13:39:03.161: E/AndroidRuntime(20716):    at java.lang.Class.newInstance(Class.java:1409)
02-02 13:39:03.161: E/AndroidRuntime(20716):    at android.app.Instrumentation.newActivity(Instrumentation.java:1040)
02-02 13:39:03.161: E/AndroidRuntime(20716):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1777)
02-02 13:39:03.161: E/AndroidRuntime(20716):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1893)
02-02 13:39:03.161: E/AndroidRuntime(20716):    at android.app.ActivityThread.access$1500(ActivityThread.java:135)
02-02 13:39:03.161: E/AndroidRuntime(20716):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1054)
02-02 13:39:03.161: E/AndroidRuntime(20716):    at android.os.Handler.dispatchMessage(Handler.java:99)
02-02 13:39:03.161: E/AndroidRuntime(20716):    at android.os.Looper.loop(Looper.java:150)
02-02 13:39:03.161: E/AndroidRuntime(20716):    at android.app.ActivityThread.main(ActivityThread.java:4385)
02-02 13:39:03.161: E/AndroidRuntime(20716):    at java.lang.reflect.Method.invokeNative(Native Method)
02-02 13:39:03.161: E/AndroidRuntime(20716):    at java.lang.reflect.Method.invoke(Method.java:507)
02-02 13:39:03.161: E/AndroidRuntime(20716):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
02-02 13:39:03.161: E/AndroidRuntime(20716):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
02-02 13:39:03.161: E/AndroidRuntime(20716):    at dalvik.system.NativeStart.main(Native Method)

I have also looked at AWS SDK NoClassDefFoundError: com.amazonaws.services.s3.AmazonS3Client

and it also says to to what i have alredy done.

How do i fix it?

3
  • in your build path, in order and export, is the library checked? Commented Feb 2, 2014 at 18:02
  • When I tried ticking the Amazon libraries in 'Order and Export' my project does not run due to out of memory problems and I need to restart Eclipse... Commented May 10, 2014 at 11:23
  • ...I fixed that problem by following the steps here in order to increase the heap size available to Eclipse: wiki.eclipse.org/… Commented May 10, 2014 at 11:37

2 Answers 2

1

You might need to follow the steps outlined in our blog to export the libraries for use in an Android application.

Sign up to request clarification or add additional context in comments.

1 Comment

This should be the correct answer - esp. as it includes a link to increasing the heap memory available to Eclipse: wiki.eclipse.org/…
1

I solved the errormyself using following:

Created a libs folder (libs not lib)And copied all jars to that folder.And it worked fine. ADT automatially puts a build time dependency on the jars inside libs folder.And it worked fine.

Originally my jars were in lib folder and i have explicit dependecy on it.So it worked at compile time but these libs were not packaked inside APK.This was strange bu i also read this somewhere.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.