gpt4 book ai didi

AndroidRuntime:致命异常: main (libGDX

转载 作者:行者123 更新时间:2023-12-03 16:51:59 26 4
gpt4 key购买 nike

我对编程很陌生,我正在努力解决下一个问题。我正在使用 LibGDX 创建基于 Tiled 的游戏(以下教程)。现在桌面部分一切正常,并且可以正常工作。但是当我尝试运行 android 部分时,它会立即崩溃。在我的 logcat 和代码下方。需要更多信息,请告诉我。欢迎任何帮助。

02-15 20:59:16.135      356-356/com.sparetimegaming.game.android W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x40015560)
02-15 20:59:16.225 356-356/com.sparetimegaming.game.android E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sparetimegaming.game.android/com.sparetimegaming.game.android.AndroidLauncher}: com.badlogic.gdx.utils.GdxRuntimeException: Libgdx requires OpenGL ES 2.0
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Libgdx requires OpenGL ES 2.0
at com.badlogic.gdx.backends.android.AndroidGraphics.createGLSurfaceView(AndroidGraphics.java:127)
at com.badlogic.gdx.backends.android.AndroidGraphics.<init>(AndroidGraphics.java:107)
at com.badlogic.gdx.backends.android.AndroidGraphics.<init>(AndroidGraphics.java:100)
at com.badlogic.gdx.backends.android.AndroidApplication.init(AndroidApplication.java:133)
at com.badlogic.gdx.backends.android.AndroidApplication.initialize(AndroidApplication.java:99)
at com.sparetimegaming.game.android.AndroidLauncher.onCreate(AndroidLauncher.java:15)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3683) 
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
02-15 20:59:18.825 356-356/com.sparetimegaming.game.android I/Process﹕ Sending signal. PID: 356 SIG: 9

在我的启动器下方:
package com.sparetimegaming.game.desktop;

import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.sparetimegaming.game.TiledMapGame;

public class DesktopLauncher {
public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.title = "TiledMapGame";
config.width = 1280;
config.height = 720;
config.useGL30 = true;
new LwjglApplication(new TiledMapGame(), config);
}
}




package com.sparetimegaming.game.android;

import android.os.Bundle;

import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.sparetimegaming.game.TiledMapGame;

public class AndroidLauncher extends AndroidApplication {
@Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
initialize(new TiledMapGame(), config);
}
}

最佳答案

如果您使用的是模拟器,则模拟器可能是问题所在。

正如你在这里看到的:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sparetimegaming.game.android/com.sparetimegaming.game.android.AndroidLauncher}: com.badlogic.gdx.utils.GdxRuntimeException: Libgdx requires OpenGL ES 2.0

它说 Libgdx 需要 Open GL 2.0。这是处理模拟器时的常见错误。尝试使用旧版本的模拟器(低于 API 19),看看它是否可以工作。如果你有一部安卓手机,你也可以尝试在那里运行它。 (我假设您使用的是模拟器)。

已报告类似问题 herehere .

关于AndroidRuntime:致命异常: main (libGDX,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28531306/

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