22
votes

I am getting following exception when I am trying to run my Android project.

Conversion to Dalvik format failed: Unable to execute dex: java.nio.BufferOverflowException

Currently now I am using ADT version 22.3. My project target is API level-15. I tried to add Support library in Android tools, but problem not resolved.

11
How can i uninstall Build- 19saa
clean project. Did you use Android libraries? Maybe they use support library (it can be problem with redudant libraries)Unii
Thanks Gopal Rao.. Problem solved.. :)saa

11 Answers

47
votes

the key is to set target=android-19 from project.properties and android:targetSdkVersion="19" same to 19. This has worked for me.

14
votes

Its a big mess... Following way did the trick for me...

Right click your project in eclipse -> Android Tools -> Add Support Library

Then click Accept License and click install.

5
votes

I had the same problem and I used these methods

1- Downgrading to Android SDK build tools 18.1.1

2- Adding the support library. (if it already there, try removing it and adding it again, Right click on project -> Android tools -> Add support library)

you can follow the detailed instructions here http://techlovejump.in/2013/11/how-to-solve-unable-to-execute-dex-java-nio-bufferoverflowexception-check-the-eclipse-log-for-stack-trace/

2
votes

Is this the same problem as Android dex gives a BufferOverflowException when building ? Updating to the 19.0.1 Build-tools (as described in the linked post) fixed this problem for me.

1
votes

Browse through your eclipse Folder-> Open Eclipse Folder Open eclipse.ini Change -Xms40m And -Xmx384m TO -Xms512m And -Xmx512m

Click Save

0
votes

No need to downgrade. You can fix the error by editing the manifest file or project properties. Add following line.

sdk.build.tools=18.1.1

replace 18.1.1 with your targetsdk in manifest.

Step by step detail on :- http://techlovejump.in/2013/11/how-to-solve-unable-to-execute-dex-java-nio-bufferoverflowexception-check-the-eclipse-log-for-stack-trace/

0
votes

I Update the project.properties file. I put sdk.build.tools=19.0.1 in property file. And set the minimum SDK version to 14

0
votes

it happened to me when my emulator had set a high Ram value, i changed the emulator RAM value to 768 and then it worked

0
votes

I've dealt with this problem when using Sherlock ActionBar library in my project. You could do the following step, it's work for me.

  1. Right click to your project, select properties.
  2. A dialog will show up, select 'Java build path' on the left menu.
  3. Remove 'Android dependencies' and 'Android private libraries' on the right panel then click OK
  4. Clean your project (select menu Project --> Clean)
  5. Right click your project, select Android Tools -> Fix project properties
  6. Clean project once again.
  7. Restart your computer
  8. Open eclipse and Export apk

Hope that will help you.

0
votes

I was having redundant libraries in my IDE that was causing an issue none of the other solution worked for me