dex issues with Latest SDK

1479 views
Skip to first unread message

Dan

unread,
Oct 31, 2013, 5:56:01 PM10/31/13
to android-d...@googlegroups.com
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
with:

[dex]
Converting compiled files and external libraries into /....snip.../bin/classes.dex...
[dx]
[dx] UNEXPECTED TOP-LEVEL EXCEPTION:
[dx] java.nio.BufferOverflowException
[dx] at java.nio.Buffer.nextPutIndex(Buffer.java:499)
[dx] at java.nio.HeapByteBuffer.putShort(HeapByteBuffer.java:296)
[dx] at com.android.dex.Dex$Section.writeShort(Dex.java:818)
[dx] at com.android.dex.Dex$Section.writeTypeList(Dex.java:870)
[dx] at com.android.dx.merge.DexMerger$3.write(DexMerger.java:437)
[dx] at com.android.dx.merge.DexMerger$3.write(DexMerger.java:423)
[dx] at com.android.dx.merge.DexMerger$IdMerger.mergeUnsorted(DexMerger.java:317)
[dx] at com.android.dx.merge.DexMerger.mergeTypeLists(DexMerger.java:423)
[dx] at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:163)
[dx] at com.android.dx.merge.DexMerger.merge(DexMerger.java:187)
[dx] at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
[dx] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
[dx] at com.android.dx.command.dexer.Main.run(Main.java:230)
[dx] at com.android.dx.command.dexer.Main.main(Main.java:199)
[dx] at com.android.dx.command.Main.main(Main.java:103)

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

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

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 'com.android.support:support-v4:18.0.0'
}

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.

Cheers,

Brad

Dan

unread,
Nov 1, 2013, 10:34:21 AM11/1/13
to android-d...@googlegroups.com

Thanks for the hint.  I had a mismatched project.properties 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: 
...snip...
Reply all
Reply to author
Forward
0 new messages