dex issues with Latest SDK

Skip to first unread message


Oct 31, 2013, 5:56:01 PM10/31/13
So, I upgraded my SDK today and tried to rebuild all my stuff (command
line from scons file.)  First 2 projects went fine, the 3rd is now failing

Converting compiled files and external libraries into /....snip.../bin/classes.dex...
[dx] java.nio.BufferOverflowException
[dx] at java.nio.Buffer.nextPutIndex(
[dx] at java.nio.HeapByteBuffer.putShort(
[dx] at$Section.writeShort(
[dx] at$Section.writeTypeList(
[dx] at$3.write(
[dx] at$3.write(
[dx] at$IdMerger.mergeUnsorted(
[dx] at
[dx] at
[dx] at
[dx] at
[dx] at
[dx] at
[dx] at
[dx] at

Anybody pointers on how to get it to not fail this way (or more info that would help
folks fix it?)

       Dan Schmitt

Bradley O'Hearne

Oct 31, 2013, 10:26:18 PM10/31/13
to Android Developers

I literally just worked through this error — mine was caused by adding the Facebook SDK as a module dependency to a project in the latest version of Android Studio. In my case, I saw a stack trace very similar to yours, but the actual exception was further upstream, and the error was due to the fact that the Facebook SDK uses a different version of the android support jar than my primary project. I had to go into the Facebook SDK’s build.gradle file and comment out its jar and use the other one that my primary project was using, as follows:

dependencies {
// compile files('libs/android-support-v4.jar')
compile ''

After fixing that, all problems disappeared. I don’t know if this is going to help you even a little, but I’ve spent the day stumbling around in the spooky Halloween land of undocumented tools and APIs, and thought I’d at least try to lend a hand. Good luck, and let me know if you are able to make it through.




Nov 1, 2013, 10:34:21 AM11/1/13

Thanks for the hint.  I had a mismatched target= value
and AndroidManifest.xml SdkValue combo which was apparently harmless
before, but now seems to cause the dexopt to try to use both versions of
the platform jar.

On Thursday, October 31, 2013 10:26:18 PM UTC-4, Brad OHearne wrote: 
Reply all
Reply to author
0 new messages