Skip to content

Android: No virtual method position(I)Ljava/nio/ByteBuffer #516

@dbrgn

Description

@dbrgn

Since version 0.8.19, our Android CI (using Android 5 and 6 devices) started failing on a msgpack test. Here's a simplified reproducer:

@RunWith(AndroidJUnit4.class)
@SmallTest
public class MsgpackTest {
	@Test
	public void testPutString() throws Exception {
		ByteArrayOutputStream out = new ByteArrayOutputStream();
		MessagePacker packer = MessagePack.newDefaultPacker(out);
		packer.packString("hello android");
	}
}

The error message:

java.lang.NoSuchMethodError: No virtual method position(I)Ljava/nio/ByteBuffer; in class Ljava/nio/ByteBuffer; or its super classes (declaration of 'java.nio.ByteBuffer' appears in /system/framework/core-libart.jar)
  at org.msgpack.core.buffer.MessageBufferU.resetBufferPosition(MessageBufferU.java:70)
  at org.msgpack.core.buffer.MessageBufferU.putBytes(MessageBufferU.java:232)
  at org.msgpack.core.MessagePacker.addPayload(MessagePacker.java:1073)
  at org.msgpack.core.MessagePacker.addPayload(MessagePacker.java:1043)
  at org.msgpack.core.MessagePacker.packStringWithGetBytes(MessagePacker.java:659)
  at org.msgpack.core.MessagePacker.packString(MessagePacker.java:732)
  ...

This is most probably due to the changes in #514 (cc @ppkarwasz). The test succeeds when running with msgpack-core version 0.8.18.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions