libgdx/libgdx — pull request #1939 by schleinzer (2014-06-06 15:05:30+00:00)
Title: libGDX game crashes on ART, Google's successor for dalvik.

Reason is the allocation of a ByteBuffer of size "0" in "IndexBufferObject". This breaks all libGDX Meshes which don't make use of indexes and set the "maxIndexes" to 0 (which in turn breaks quite a lot of libGDX apps on ART I assume.)

While allocating a 0-sized ByteBuffer is perfectly fine according to the javadoc, ART has a bug that makes programs crash if they try to do so. Only sizes >0 do work.

This is a bug in ART admitted and even fixed by Google with https://android-review.googlesource.com/#/c/73175/ .

Unfortunately, that fix is (although committed half a year ago...) not even part of current Android (4.4.3 as of this writing), and it's still unknown (to me) in which release it will finally be available.

So I kindly ask you to accept this pull request to work around that problem for the time being.

Thank you!