18
votes

Everytime i want to run my Android application i get a error:

[2013-11-02 13:05:36 - Dex Loader] Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.
[2013-11-02 13:05:36 - **********] Conversion to Dalvik format failed: Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.

I google'd it but haven't found anything. I have set the permsize to 512m, Xms1024m and Xmx2048m. I'm using v22.0.0-675183.

.Log:

!ENTRY com.android.ide.eclipse.adt 4 0 2013-11-02 13:05:36.597
!MESSAGE Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log             for stack trace.
!STACK 0
java.nio.BufferOverflowException
at java.nio.Buffer.nextPutIndex(Unknown Source)
at java.nio.HeapByteBuffer.putShort(Unknown Source)
at com.android.dex.Dex$Section.writeShort(Dex.java:818)
at com.android.dex.Dex$Section.writeTypeList(Dex.java:870)
at com.android.dx.merge.DexMerger$3.write(DexMerger.java:437)
at com.android.dx.merge.DexMerger$3.write(DexMerger.java:423)
at com.android.dx.merge.DexMerger$IdMerger.mergeUnsorted(DexMerger.java:317)
at com.android.dx.merge.DexMerger.mergeTypeLists(DexMerger.java:423)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:163)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:187)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:187)
at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:780)
at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:593)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:726)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:321)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:396)
at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
at org.eclipse.core.internal.resources.Project.build(Project.java:124)
at com.android.ide.eclipse.adt.internal.project.ProjectHelper.doFullIncrementalDebugBuild(ProjectHelper.java:1057)
at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:147)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:855)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:704)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1047)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1251)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
13
Have you recently installed build tools version 19.0.0? If so see: stackoverflow.com/questions/19741260/… and the link in thatNickT
@NickT I've installed: SDK Build-tools 18.0.1 and 17RobinF
Oh, then it's not version 19 of the build tools then. I've just updated to kitkat and my builds were ok until then, when I got the same error as you. Deleting build tools 19 fixed it for me. Sorry I can't help furtherNickT

13 Answers

38
votes

I was able to get my problem project to build by adding this extra line:

sdk.buildtools=18.1.1

...to my project.properties file, which is present in the root of the project folder. All other approaches seemed to fail for me.

29
votes
14
votes

After the installation of the new sdk, there is a new folder "Android Dependencies" under your project file. If you right click and remove it from build path, you will be able to build again your project.

11
votes

I have solved by setting the project build target to API 19.

11
votes

I have also got the same problem. just, I have uninstalled SDK build 19 and restarted eclicpse.hope this helps and google will fix this issue soon...

4
votes

right click your project > android tools > android support library

hope this helps :)

3
votes

In the file project.properties, replace
target=android-??
with
target=android-19

3
votes

I just deleted Android dependencies from project > properties > java build path > libraries. After I clean the project and run it

2
votes

Try to delete the build 19 folder manually.

1
votes

I have solved my problem by installing android sdk platform tools and sdk Build tools in sdk manager

0
votes

Try right click your project > android > Project build Target >select less version than 4.4 and try to clean the project.

It worked for me. :)

0
votes

I have solved by setting the target=android-19 or must match to the targetSDk under manifest. target=android found under project.properties in root directory of the project..

Hope this Help...

0
votes

I have solved this with build tools 19.0.1 and project build target to API 19. With build tools 19.0 I have this problem.