UnsatisfiedLinkError Libgdx桌面 [英] UnsatisfiedLinkError Libgdx Desktop

查看:110
本文介绍了UnsatisfiedLinkError Libgdx桌面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在桌面上遇到LibGDX的问题.尝试启动应用程序时,我始终收到以下错误:

I am running into issues with LibGDX on Desktop. I keep getting the following error when trying to launch the application:

Exception in thread "main" java.lang.UnsatisfiedLinkError: com.badlogic.gdx.utils.BufferUtils.newDisposableByteBuffer(I)Ljava/nio/ByteBuffer;
at com.badlogic.gdx.utils.BufferUtils.newDisposableByteBuffer(Native Method)
at com.badlogic.gdx.utils.BufferUtils.newUnsafeByteBuffer(BufferUtils.java:288)
at com.badlogic.gdx.graphics.glutils.VertexArray.<init>(VertexArray.java:62)
at com.badlogic.gdx.graphics.glutils.VertexArray.<init>(VertexArray.java:53)
at com.badlogic.gdx.graphics.Mesh.<init>(Mesh.java:148)
at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:173)
at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:142)
at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:121)
at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:115)

我在我的项目中添加了以下库:

I have the following libraries added to my project:

  • gdx.jar
  • gdx-sources.jar
  • gdx-natives.jar
  • gdx-backend-lwjgl.jar
  • gdx-backend-lwjgl-natives.jar

我想念什么吗?

我进行了上下搜索,但是我发现的所有内容都是针对Android的,它告诉我将arm文件夹中的.so库添加到我的项目中,但是对于Wintel平台上的桌面项目而言,这没有意义

I have searched high and low, but everything I find is for Android and tells me to add the .so libs from the arm folders to my project, but that doesn't make sense to me for a desktop project on wintel platform.

推荐答案

我建议您使用

I'd advise you to setup your projects with this GUI. It should provide you with a valid setup for all platforms. You may also use the latest nightly builds and check if the problem still occurs. The problem might be that the native libraries do not match the other jars.

另一个问题可能是您太早实例化了SpriteBatch(或内部使用SpriteBatch的其他东西)(在stacktrace中看起来像这样).例如静态地像这样:

Another problem might be that you instantiate a SpriteBatch (or something else which internally uses a SpriteBatch) too early (looked a bit like this in the stacktrace). For example statically like this:

private static SpriteBatch batch = new SpriteBatch();

这是行不通的,因为此时libgdx设置不正确.而是在游戏的create/show方法中创建此类内容.

This won't work, since libgdx wasn't setup correctly at this point in time. Instead, create such things in the create/show methods of your game.

这篇关于UnsatisfiedLinkError Libgdx桌面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆