gpt4 book ai didi

java - LibGDX HelloWorld 项目在 Android 模拟器上运行时崩溃

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:57:30 28 4
gpt4 key购买 nike

作为学习 LibGDX 的一部分,我一直在尝试运行 Hello-World 项目。使用每晚构建 (libgdx-nightly-20140322)。但是,我变得非常沮丧,因为 hello-world-desktop 项目在作为 Java 应用程序运行时可以正常工作,而 hello-world-html 项目将作为 Web 应用程序运行。但是 hello-world-android simple 会产生一个描述性不强的错误:

image of LibGDX failure in Android emulator

我在这里查看是否存在类似问题并找到了 Android Emulator does not launch LibGDX project? ,但给出的解决方案不适用于我所拥有的。还有libgdx my first triangle tutorial not working? ,这让我找到了可以尝试的新教程,但无济于事。

我第一次尝试按照 GITHUB 上的教程进行操作,以及第二次 Games from Scratch 的 LibGDX Tutorial 1: Creating an initial project .我尝试了不同的 API 级别 8、13、16 和 19。

这是日志文件的转储:

03-28 03:41:33.344: E/Trace(622): error opening trace file: No such file or directory (2)
03-28 03:41:33.435: D/dalvikvm(622): Trying to load lib /data/data/com.me.mygdxgame/lib/libgdx.so 0x411e9590
03-28 03:41:33.445: D/dalvikvm(622): Added shared lib /data/data/com.me.mygdxgame/lib/libgdx.so 0x411e9590
03-28 03:41:33.445: D/dalvikvm(622): No JNI_OnLoad found in /data/data/com.me.mygdxgame/lib/libgdx.so 0x411e9590, skipping init
03-28 03:41:33.465: D/libEGL(622): Emulator without GPU support detected. Fallback to software renderer.
03-28 03:41:33.496: D/libEGL(622): loaded /system/lib/egl/libGLES_android.so
03-28 03:41:33.535: D/AndroidRuntime(622): Shutting down VM
03-28 03:41:33.535: W/dalvikvm(622): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
03-28 03:41:33.555: E/AndroidRuntime(622): FATAL EXCEPTION: main
03-28 03:41:33.555: E/AndroidRuntime(622): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.me.mygdxgame/com.me.mygdxgame.MainActivity}: java.lang.RuntimeException: Libgdx requires OpenGL ES 2.0
03-28 03:41:33.555: E/AndroidRuntime(622): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
03-28 03:41:33.555: E/AndroidRuntime(622): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
03-28 03:41:33.555: E/AndroidRuntime(622): at android.app.ActivityThread.access$600(ActivityThread.java:130)
03-28 03:41:33.555: E/AndroidRuntime(622): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
03-28 03:41:33.555: E/AndroidRuntime(622): at android.os.Handler.dispatchMessage(Handler.java:99)
03-28 03:41:33.555: E/AndroidRuntime(622): at android.os.Looper.loop(Looper.java:137)
03-28 03:41:33.555: E/AndroidRuntime(622): at android.app.ActivityThread.main(ActivityThread.java:4745)
03-28 03:41:33.555: E/AndroidRuntime(622): at java.lang.reflect.Method.invokeNative(Native Method)
03-28 03:41:33.555: E/AndroidRuntime(622): at java.lang.reflect.Method.invoke(Method.java:511)
03-28 03:41:33.555: E/AndroidRuntime(622): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
03-28 03:41:33.555: E/AndroidRuntime(622): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
03-28 03:41:33.555: E/AndroidRuntime(622): at dalvik.system.NativeStart.main(Native Method)
03-28 03:41:33.555: E/AndroidRuntime(622): Caused by: java.lang.RuntimeException: Libgdx requires OpenGL ES 2.0
03-28 03:41:33.555: E/AndroidRuntime(622): at com.badlogic.gdx.backends.android.AndroidGraphics.createGLSurfaceView(AndroidGraphics.java:118)
03-28 03:41:33.555: E/AndroidRuntime(622): at com.badlogic.gdx.backends.android.AndroidGraphics.<init>(AndroidGraphics.java:90)
03-28 03:41:33.555: E/AndroidRuntime(622): at com.badlogic.gdx.backends.android.AndroidApplication.initialize(AndroidApplication.java:97)
03-28 03:41:33.555: E/AndroidRuntime(622): at com.me.mygdxgame.MainActivity.onCreate(MainActivity.java:15)
03-28 03:41:33.555: E/AndroidRuntime(622): at android.app.Activity.performCreate(Activity.java:5008)
03-28 03:41:33.555: E/AndroidRuntime(622): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
03-28 03:41:33.555: E/AndroidRuntime(622): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
03-28 03:41:33.555: E/AndroidRuntime(622): ... 11 more

最佳答案

正如@Sid 在评论中指出的那样,该错误表明 LibGDX 需要 OpenGL ES 2.0 支持。模拟器的软件渲染器不支持 OpenGL ES 2.0。

您可以通过在模拟器中启用图形加速来让您的模拟器支持。参见 http://developer.android.com/tools/devices/emulator.html#accel-graphicsAndroid OpenGL ES 2.0 emulator

这是突出显示设置的 Android 虚拟设备管理器对话框。启用此功能肯定可以解决 Macbook Air 以及许多其他计算机上的问题。

Click Use Host GPU

关于java - LibGDX HelloWorld 项目在 Android 模拟器上运行时崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22703940/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com