0

I know this is a well known issue of "Conversion to Dalvik format failed with error 1".

I goggled for it also but it is not able to solve my problem.

My Goal is to integrate Amazon s3 to upload image from my Android application.

I just download aws-android-sdk-1.4.4 from here and following reference links like,

Mobile Photo Uploads to Amazon S3

Getting Started Guide

I started with Creating New Android Project ver 4.1.2 and copied all jar files available with aws-android-sdk-1.4.4 to libs folder of my application.

Problem Start here only,

I am trying to run my application and it is throwing this error "Conversion to Dalvik format failed with error 1".

Note : I have just copied jar files to libs folder only and not imported yet into application.

I have two questions regarding this.

  1. How to solve this "Conversion to Dalvik format failed with error 1" error?

  2. My only need is to upload image to Amazon S3 server, Is all jar files are required to add?

EDIT :

Following are the jar files I got with aws-android-sdk-1.4.4.

  1. aws-android-sdk-1.4.4.jar
  2. aws-android-sdk-1.4.4-autoscaling.jar
  3. aws-android-sdk-1.4.4-cloudwatch.jar
  4. aws-android-sdk-1.4.4-core.jar
  5. aws-android-sdk-1.4.4-ddb.jar
  6. aws-android-sdk-1.4.4-ddb-mapper.jar
  7. aws-android-sdk-1.4.4-ddb-mapper-debug.jar
  8. aws-android-sdk-1.4.4-debug.jar
  9. aws-android-sdk-1.4.4-ec2.jar
  10. aws-android-sdk-1.4.4-elb.jar
  11. aws-android-sdk-1.4.4-s3.jar
  12. aws-android-sdk-1.4.4-sdb.jar
  13. aws-android-sdk-1.4.4-ses.jar
  14. aws-android-sdk-1.4.4-sns.jar
  15. aws-android-sdk-1.4.4-sqs.jar
  16. aws-android-sdk-1.4.4-sts.jar

Any help is Appreciated.

Thanks.

Pratik Sharma
  • 13,307
  • 5
  • 27
  • 37
  • I find that this error generally occurred for me when the same jar file has been duplicated in multiple places. Check for these conditions – Vrashabh Irde Dec 20 '12 at 10:35
  • @Slartibartfast thanks for the reply. I have edited my question with list of jar files available and being used. – Pratik Sharma Dec 20 '12 at 10:41
  • Basically you have to check for two or more JAR files on your buildpath that include the same package and classes - this will cause this error – Vrashabh Irde Dec 20 '12 at 10:43
  • Also clean the project - look here for more on this error http://stackoverflow.com/questions/2680827/conversion-to-dalvik-format-failed-with-error-1-on-external-jar – Vrashabh Irde Dec 20 '12 at 10:45
  • @Slartibartfast not getting exactly. Can you explain me a bit more. And I have clean up and restart eclipse many times also. – Pratik Sharma Dec 20 '12 at 10:46
  • Have you tried the S3_Uploader example included in the SDK? Do you get the same error there as well? That might point to a problem with your eclipse setup. – Bob Kinney Dec 20 '12 at 16:23

1 Answers1

3

I help maintain the AWS SDK for Android and I'm sorry you're encountering problems. Regarding the second part of your question first, As noted in the Getting Started Guide:

Copy either a bundled JAR for all services or the specific JARs for the services you wish to use. You have 3 options:

Add aws-android-sdk-VERSION-debug.jar. This JAR creates the largest APK, but allows for full stack traces during development.

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

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, copying both bundled JARs and service JARs will cause errors.

In your cases this translates to using one of the 3 following setups:

  1. aws-android-sdk-1.4.4.jar
  2. aws-android-sdk-1.4.4-debug.jar
  3. aws-android-sdk-1.4.4-core.jar and aws-android-sdk-1.4.4-s3.jar

Regarding your error, as noted in other comments: make sure you have not included multiple copies of JAR files in your build path and also make sure you have not copied more than the necessary AWS SDK JARs.

Community
  • 1
  • 1
Bob Kinney
  • 8,870
  • 1
  • 27
  • 35
  • Thanks for the reply. Yes that solve my problem and now I am able to run my application. Now getting this error `com.amazonaws.AmazonClientException: Unable to execute HTTP request: Connection to https://s3.amazonaws.com refused` while creating `s3 client` object. Will check that at my end. Thanks again. – Pratik Sharma Dec 25 '12 at 10:46