Skip to content

Unable to call ByteBuffer#position(int) #667

@fgnm

Description

@fgnm

Issue details

I'm trying to execute the following code, but whenever I try to reset the buffer position to 0 I got a crash on JVM side (NoSuchMethodError).

Reproduction steps/code

public static ByteBuffer readAllBytes(InputStream inputStream) {
        ByteBuffer byteBuffer = null;
        try {
            byteBuffer = ByteBuffer.allocate(inputStream.available());
            Channels.newChannel(inputStream).read(byteBuffer);
            byteBuffer.position(0);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return byteBuffer;
    }

Build Tools:

  • IDEA plugin
  • Eclipse plugin
  • Gradle plugin

Versions:

Please provide the version of RoboVM, XCode and JDK used

  • Robovm: 2.3.18
  • Xcode: 13.3.1
  • JDK: Android Studio Default JDK 11.0.12

Build Targets:
iPhone 7

Stacktrace

java.lang.NoSuchMethodError: java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer;
	at games.rednblack.gdxar.ios.ARKitApplication.readAllBytes(ARKitApplication.java:357)
	at games.rednblack.gdxar.ios.ARKitApplication.buildAugmentedImageDatabase(ARKitApplication.java:337)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions