在Android模拟器上运行时LibGDX HelloWorld项目崩溃 [英] LibGDX HelloWorld project crashes when run on Android emulator

查看:199
本文介绍了在Android模拟器上运行时LibGDX HelloWorld项目崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图让你好世界中的项目为学习LibGDX的一部分运行。使用每晚构建(libgdx-夜间-20140322)。不过,我已经变得非常沮丧,因为,当一个Java应用程序运行的hello-world-桌面项目工作,你好,世界HTML项目将运行作为一个Web应用程序。但是,HELLO-世界的android简单的产生不是很描述性错误:

我已经检查了在这里寻找类似的问题,发现<一href="http://stackoverflow.com/questions/10972035/android-emulator-does-not-launch-libgdx-project">Android仿真器不启动LibGDX项目?,但考虑到的解决方案不与我有什么工作。还有<一个href="http://stackoverflow.com/questions/10970039/libgdx-my-first-triangle-tutorial-not-working">libgdx我的第一个三角形的教程不工作?,它向我指出新的教程来尝试,但都无济于事。

我第一次尝试遵循 GitHub上教程,并从头开始的<第二次游戏href="http://www.gamefromscratch.com/post/2013/09/19/LibGDX-Tutorial-1-Creating-an-initial-project.aspx">LibGDX教程1:创建初始的项目。 我曾尝试不同的API等级8,13,16,和放大器; 19。

下面是日志文件的转储:

  3月3日至28日:41:33.344:E /跟踪(622):错误打开跟踪文件:没有这样的文件或目录(2)
3月3日至28日:41:33.435:D / dalvikvm(622):试图加载LIB /data/data/com.me.mygdxgame/lib/libgdx.so 0x411e9590
3月3日至28日:41:33.445:D / dalvikvm(622):/data/data/com.me.mygdxgame/lib/libgdx.so 0x411e9590添加共享库
3月3日至28日:41:33.445:D / dalvikvm(622):没有JNI_OnLoad在/data/data/com.me.mygdxgame/lib/libgdx.so 0x411e9590发现,跳绳的init
3月3日至28日:41:33.465:D / libEGL(622):仿真器没有检测GPU的支持。回退到软件渲染器。
3月3日至28日:41:33.496:D / libEGL(622):加载/system/lib/egl/libGLES_android.so
3月3日至28日:41:33.535:D / AndroidRuntime(622):关闭虚拟机
3月3日至28日:41:33.535:W / dalvikvm(622):主题ID = 1:螺纹退出与未捕获的异常(组= 0x40a13300)
3月3日至28日:41:33.555:E / AndroidRuntime(622):致命异常:主要
3月3日至28日:41:33.555:E / AndroidRuntime(622):java.lang.RuntimeException的:无法启动的活动ComponentInfo {com.me.mygdxgame / com.me.mygdxgame.MainActivity}:java.lang.RuntimeException的:Libgdx需要OpenGL ES 2.0
3月3日至28日:41:33.555:E / AndroidRuntime(622):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
3月3日至28日:41:33.555:E / AndroidRuntime(622):在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
3月3日至28日:41:33.555:E / AndroidRuntime(622):在android.app.ActivityThread.access $ 600(ActivityThread.java:130)
3月3日至28日:41:33.555:E / AndroidRuntime(622):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1195)
3月3日至28日:41:33.555:E / AndroidRuntime(622):在android.os.Handler.dispatchMessage(Handler.java:99)
3月3日至28日:41:33.555:E / AndroidRuntime(622):在android.os.Looper.loop(Looper.java:137)
3月3日至28日:41:33.555:E / AndroidRuntime(622):在android.app.ActivityThread.main(ActivityThread.java:4745)
3月3日至28日:41:33.555:E / AndroidRuntime(622):在java.lang.reflect.Method.invokeNative(本机方法)
3月3日至28日:41:33.555:E / AndroidRuntime(622):在java.lang.reflect.Method.invoke(Method.java:511)
3月3日至28日:41:33.555:E / AndroidRuntime(622):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:786)
3月3日至28日:41:33.555:E / AndroidRuntime(622):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
3月3日至28日:41:33.555:E / AndroidRuntime(622):在dalvik.system.NativeStart.main(本机方法)
3月3日至28日:41:33.555:E / AndroidRuntime(622):java.lang.RuntimeException的:产生的原因Libgdx需要OpenGL ES 2.0
3月3日至28日:41:33.555:E / AndroidRuntime(622):在com.badlogic.gdx.backends.android.AndroidGraphics.createGLSurfaceView(AndroidGraphics.java:118)
。3月三号至28日:41:33.555:E / AndroidRuntime(622):在com.badlogic.gdx.backends.android.AndroidGraphics&LT; INIT&GT;(AndroidGraphics.java:90)
3月3日至28日:41:33.555:E / AndroidRuntime(622):在com.badlogic.gdx.backends.android.AndroidApplication.initialize(AndroidApplication.java:97)
3月3日至28日:41:33.555:E / AndroidRuntime(622):在com.me.mygdxgame.MainActivity.onCreate(MainActivity.java:15)
3月3日至28日:41:33.555:E / AndroidRuntime(622):在android.app.Activity.performCreate(Activity.java:5008)
3月3日至28日:41:33.555:E / AndroidRuntime(622):在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
3月3日至28日:41:33.555:E / AndroidRuntime(622):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
3月3日至28日:41:33.555:E / AndroidRuntime(622):11 ...更多
 

解决方案

由于@Sid注意到的意见,错误说LibGDX需要OpenGL ES 2.0的支持。仿真器的软件渲染器不支持OpenGL ES 2.0。

您可能能够得到你的模拟器,以支持实现图形加速的模拟器。请参阅<一href="http://developer.android.com/tools/devices/emulator.html#accel-graphics">http://developer.android.com/tools/devices/emulator.html#accel-graphics和 Android的OpenGL ES 2.0的模拟器

下面是该设置的Andr​​oid虚拟设备管理器对话框突出。启用此绝对解决在MacBook Air上的问题,可能许多其他计算机。

I've been trying to get the Hello-World project to run as part of learning LibGDX. Using the Nightly Build (libgdx-nightly-20140322). However, I have become quite frustrated because the hello-world-desktop project will work when run as a Java Application, the hello-world-html project will Run As a Web Application. But hello-world-android simple produces a not very descriptive error:

I have checked on here looking for similar problems and found Android Emulator does not launch LibGDX project?, but the solution given does not work with what I have. There was also libgdx my first triangle tutorial not working?, which pointed me to new tutorials to try, but no avail.

The first time I attempted to follow the tutorial on GITHUB, and the second time Games from Scratch's LibGDX Tutorial 1: Creating an initial project. I have tried different API Levels 8, 13, 16, & 19.

Here is the dump of the logfile:

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

解决方案

As @Sid notes in the comments, the error says LibGDX requires OpenGL ES 2.0 support. The emulator's software renderer does not support OpenGL ES 2.0.

You may be able to get your emulator to support by enabling graphics acceleration in the emulator. See http://developer.android.com/tools/devices/emulator.html#accel-graphics and Android OpenGL ES 2.0 emulator

Here is the Android Virtual Device Manager dialog with the setting highlighted. Enabling this definitely solves the problem on a Macbook Air, and likely many other computers.

这篇关于在Android模拟器上运行时LibGDX HelloWorld项目崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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