GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Android: No virtual method position(I)Ljava/nio/ByteBuffer · Issue #516 · msgpack/msgpack-java

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

New issue
Copy link
New issue
Copy link
Closed
#567
Closed
Android: No virtual method position(I)Ljava/nio/ByteBuffer#516
#567
Copy link
Assignees
xerial
Labels
bug

Description

@dbrgn
dbrgn
opened on Nov 21, 2019
Issue body actions

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.

Reacted by bnn

Activity

  1. xerial
    added
    bug
    on Nov 21, 2019
  2. ppkarwasz commented on Nov 22, 2019

    @ppkarwasz
    ppkarwasz
    on Nov 22, 2019
    Contributor
    More actions

    I believe the library must have been compiled against the wrong JRE (i.e. Java's 11 JRE was used instead of Java's 7/8): in Java 8 the classByteBuffer inherits the position method from Bufferand has a return type of java.nio.Buffer. On Java 11 the method is overridden with an implementation that returns java.nio.ByteBuffer.

    @dbrgn: can you compile the library from source and check if it still fails the tests?

  3. bananaumai commented on Nov 26, 2019

    @bananaumai
    bananaumai
    on Nov 26, 2019
    More actions

    I also faced same issues. I'm using this library for Android Project. As @ppkarwasz said, jvmTarget is configured as 1.8.

  4. dbrgn commented on Nov 26, 2019

    @dbrgn
    dbrgn
    on Nov 26, 2019
    Author
    More actions

    @dbrgn: can you compile the library from source and check if it still fails the tests?

    My local Java version:

    $ java -version
    openjdk version "1.8.0_232"
    OpenJDK Runtime Environment (build 1.8.0_232-b09)
    OpenJDK 64-Bit Server VM (build 25.232-b09, mixed mode)
    

    I compiled the library locally:

    ./sbt publishM2
    

    Then I added the local maven repo to my gradle file:

    repositories {
        ...
        maven { url "/home/<user>/.m2/repository" }
    }
    

    ...and finally forced msgpack to resolve to the snapshot version:

    configurations.all {
        resolutionStrategy.force 'org.msgpack:msgpack-core:0.8.20-SNAPSHOT'
    }
    

    With that configuration, the test passes, so I think you're right. Maybe you can release a fix?

  5. ppkarwasz commented on Nov 26, 2019

    @ppkarwasz
    ppkarwasz
    on Nov 26, 2019
    Contributor
    More actions

    @xerial, can you make another release? Version 0.8.19 is almost certainly compiled against JRE 11 and linking problems occur, when using another JRE.

    Maybe it is possible to setup Travis CI to run the test against the jar file, so oversights like this don't occur?

    Reacted by Danilo Bargen, bnn and naresh-jaggumanthri
  6. xerial commented on Nov 27, 2019

    @xerial
    xerial
    on Nov 27, 2019
    Member
    More actions

    Got it. Thanks for the investigation.

    We can add such an integration test using GitHub Action. First, I'll try to automate the release process to make sure to produce Java8 compatible jar files.

  7. xerial
    self-assigned this
    on Nov 27, 2019
  8. xerial commented on Nov 27, 2019

    @xerial
    xerial
    on Nov 27, 2019
    Member
    More actions

    Released 0.8.20 built with jdk8.

    Reacted by bnn
  9. dbrgn commented on Nov 28, 2019

    @dbrgn
    dbrgn
    on Nov 28, 2019
    Author
    More actions

    Tthank you!

  10. dbrgn
    closed this as completedon Nov 28, 2019
  11. dustin-johnson
    added a commit that references this issue on Jan 4, 2020

    Specify JDK8 for the build to avoid issues with Android like this: ms…

    cfe0425
  12. dbrgn commented on May 15, 2021

    @dbrgn
    dbrgn
    on May 15, 2021
    Author
    More actions

    @xerial unfortunately this problem is back, the test in the initial post fails again on Android 5 with msgpack-core 0.8.23, but it works fine with 0.8.22.

  13. dbrgn
    reopened this on May 15, 2021
  14. xerial
    closed this as completedin #567on May 17, 2021
  15. xerial commented on May 17, 2021

    @xerial
    xerial
    on May 17, 2021
    Member
    More actions

    @dbrgn Thanks for reporting. We have changed the release process to use GitHub Action, and now it will always use JDK8 for the release. Just release 0.8.24 built with JDK8.

    Reacted by Danilo Bargen
  16. dbrgn commented on May 17, 2021

    @dbrgn
    dbrgn
    on May 17, 2021
    Author
    More actions

    @xerial great, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @xerial
    xerial

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.