18

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)
RobinF
  • 349
  • 1
  • 2
  • 17
  • 1
    Have you recently installed build tools version 19.0.0? If so see: http://stackoverflow.com/questions/19741260/build-tools-why-so-many-versions and the link in that – NickT Nov 02 '13 at 12:17
  • @NickT I've installed: SDK Build-tools 18.0.1 and 17 – RobinF Nov 02 '13 at 12:23
  • 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 further – NickT Nov 02 '13 at 12:26
  • 1
    possible duplicate of [Android Dex gives a BufferOverflowException](http://stackoverflow.com/questions/19727915/android-dex-gives-a-bufferoverflowexception) – Fedor Nov 10 '13 at 04:40

13 Answers13

38

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.

mrrrk
  • 2,186
  • 20
  • 17
29

try to Add Android Support Library :D https://stackoverflow.com/a/19803777/544265

Community
  • 1
  • 1
c0ming
  • 3,407
  • 1
  • 21
  • 26
14

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

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

Marco Gasparetto
  • 463
  • 5
  • 10
10

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...

Gopal Gopi
  • 11,101
  • 1
  • 30
  • 43
  • this is currently a solution until Google fix the build tools version 19. Apparently there are many users getting this error and issue was opened in [issue tracker](https://code.google.com/p/android/issues/detail?id=61710). I too had to revert to v18 build tools – aviv Nov 05 '13 at 19:38
  • Thanks man. This is a valid answer. I've lost almost half an hour of precious time due to Google's incompetence. Almost always I upgrade SDK my workspaces stop working. – Mister Smith Nov 13 '13 at 08:57
  • This does answer the question. There are possibilities to restart the processes when unexpected errors occurs. – Suresh Atta Jan 04 '14 at 09:47
4

right click your project > android tools > android support library

hope this helps :)

Sourav
  • 607
  • 8
  • 9
3

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

Percy Vega
  • 1,449
  • 1
  • 16
  • 13
3

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

sssvrock
  • 549
  • 7
  • 8
2

Try to delete the build 19 folder manually.

1

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

Jaichander
  • 812
  • 2
  • 15
  • 24
0

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. :)

user3009917
  • 113
  • 9
0

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...

Wing112707
  • 21
  • 4
0

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.

Toni Gamez
  • 6,819
  • 1
  • 23
  • 18