On Oct 31, 2013, at 2:56 PM, Dan <dan.schm...@gmail.com> wrote:

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

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

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to