UnsatisfiedLinkError Libgdx Desktop(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.
推荐答案
我建议你使用 这个 GUI.它应该为您提供适用于所有平台的有效设置.您也可以使用最新的夜间版本并检查问题是否仍然存在.问题可能是本机库与其他 jar 不匹配.
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 的东西)(在堆栈跟踪中看起来有点像这样).例如像这样静态地:
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 桌面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:UnsatisfiedLinkError Libgdx 桌面


- 转换 ldap 日期 2022-01-01
- 未找到/usr/local/lib 中的库 2022-01-01
- GC_FOR_ALLOC 是否更“严重"?在调查内存使用情况时? 2022-01-01
- 如何指定 CORS 的响应标头? 2022-01-01
- java.lang.IllegalStateException:Bean 名称“类别"的 BindingResult 和普通目标对象都不能用作请求属性 2022-01-01
- 获取数字的最后一位 2022-01-01
- 在 Java 中,如何将 String 转换为 char 或将 char 转换 2022-01-01
- Eclipse 的最佳 XML 编辑器 2022-01-01
- 如何使 JFrame 背景和 JPanel 透明且仅显示图像 2022-01-01
- 将 Java Swing 桌面应用程序国际化的最佳实践是什么? 2022-01-01