Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when use AndroidStudio open and run #49

Closed
peerless2012 opened this issue Jun 2, 2021 · 1 comment
Closed

Crash when use AndroidStudio open and run #49

peerless2012 opened this issue Jun 2, 2021 · 1 comment

Comments

@peerless2012
Copy link

peerless2012 commented Jun 2, 2021

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 net.mgsx.gltf.loaders.shared.data.DataResolver.getBufferByte(DataResolver.java:84)
        at net.mgsx.gltf.loaders.shared.data.DataResolver.getBufferShort(DataResolver.java:78)
        at net.mgsx.gltf.loaders.shared.geometry.MeshLoader.loadIndices(MeshLoader.java:353)
        at net.mgsx.gltf.loaders.shared.geometry.MeshLoader.load(MeshLoader.java:54)
        at net.mgsx.gltf.loaders.shared.GLTFLoaderBase.getNode(GLTFLoaderBase.java:277)
        at net.mgsx.gltf.loaders.shared.GLTFLoaderBase.loadScene(GLTFLoaderBase.java:199)
        at net.mgsx.gltf.loaders.shared.GLTFLoaderBase.loadScenes(GLTFLoaderBase.java:178)
        at net.mgsx.gltf.loaders.shared.GLTFLoaderBase.load(GLTFLoaderBase.java:126)
        at net.mgsx.gltf.loaders.gltf.GLTFLoader.load(GLTFLoader.java:16)
        at net.mgsx.gltf.loaders.gltf.GLTFLoader.load(GLTFLoader.java:11)
        at net.mgsx.gltf.examples.GLTFQuickStartExample.create(GLTFQuickStartExample.java:41)
        at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:278)
        at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1520)
        at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1248)
@peerless2012 peerless2012 changed the title Crash 我很 Crash when use AndroidStudio open and run Jun 2, 2021
@mgsx-dev
Copy link
Owner

sorry for the delay. This issue is due to a kind of mismatch between JDK and Android. A controversial workaround has been added in libGDX (see libgdx/libgdx#6331) but apparently there are some cleaner way to fix it in your project, see this article : https://www.morling.dev/blog/bytebuffer-and-the-dreaded-nosuchmethoderror/.

Another workaround is to use JDK 8 when compiling for Android.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants