java - Android 工作室 LibGDX

标签 java android libgdx

抱歉,如果这个问题会非常模糊,但最近尝试在 Android 工作室上使用 LibGDX 并在

的指导下制作游戏

https://www.youtube.com/watch?v=rzBVTPaUUDg&list=PLZm85UZQLd2TPXpUJfDEdWTSgszionbJy

一切似乎都很好,因为它可以在桌面启动器上运行,但是当我厌倦在 Android 模拟器上启动游戏应用程序时,该应用程序根本无法打开,并且立即显示“应用程序已终止”。

以某种方式总结这个问题,在 libgdx 上创建的所有内容在桌面启动器上都可以正常工作,例如那个 YouTuber,但是当我需要它在 Android 模拟器上运行时,它不起作用。

这是错误消息:

01/27 06:36:30: Launching android
$ adb push C:\Users\Lenovo\Desktop\TestGame\TGame\android\build\outputs\apk\android-debug.apk /data/local/tmp/com.kyh.game
$ adb shell pm install -r "/data/local/tmp/com.kyh.game"

Success

$ adb shell am start -n "com.kyh.game/com.kyh.game.AndroidLauncher" 
-a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Waiting for process to come online
Waiting for process to come online

Connected to process 2395 on device emulator-5554
I/AndroidInput: sensor listener setup
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 1

                  [ 01-26 22:37:34.185  2395: 2424 D/         ]
                  HostConnection::get() New Host Connection established 0x7f235f7cbd60, tid 2424
W/GL2JNIView: creating OpenGL ES 2.0 context
W/GL2JNIView: Returning a GLES 2 context
E/EGL_emulation: tid 2427: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2362271940, error=EGL_BAD_MATCH
I/GL2: all initialized 2
I/AndroidGraphics: OGL renderer: Android Emulator OpenGL ES Translator (Intel(R) HD Graphics 4600)
I/AndroidGraphics: OGL vendor: Google (Intel)
I/AndroidGraphics: OGL version: OpenGL ES 2.0 (4.3.0 - Build 10.18.14.4029)
I/AndroidGraphics: OGL extensions: GL_EXT_debug_marker GL_OES_EGL_image 
GL_OES_EGL_image_external GL_OES_depth24 GL_OES_depth32 
GL_OES_element_index_uint GL_OES_texture_float GL_OES_texture_float_linear 
GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture 
GL_OES_depth_texture GL_OES_texture_half_float GL_OES_texture_half_float_linear     
GL_OES_packed_depth_stencil GL_OES_vertex_half_float GL_OES_texture_npot 
GL_OES_rgb8_rgba8 ANDROID_EMU_CHECKSUM_HELPER_v1 
E/EGL_emulation: [getAttribValue] Bad attribute idx
E/EGL_emulation: tid 2424: eglGetConfigAttrib(815): error 0x3004 (EGL_BAD_ATTRIBUTE)
E/EGL_emulation: [getAttribValue] Bad attribute idx
E/EGL_emulation: tid 2424: eglGetConfigAttrib(815): error 0x3004 
(EGL_BAD_ATTRIBUTE)    
I/AndroidGraphics: framebuffer: (5, 6, 5, 0)
I/AndroidGraphics: depthbuffer: (16)
I/AndroidGraphics: stencilbuffer: (0)
I/AndroidGraphics: samples: (0)
I/AndroidGraphics: coverage sampling: (false)
I/AndroidGraphics: Managed meshes/app: { }
I/AndroidGraphics: Managed textures/app: { }
I/AndroidGraphics: Managed cubemap/app: { }
I/AndroidGraphics: Managed shaders/app: { }
I/AndroidGraphics: Managed buffers/app: { }
Application terminated.

最佳答案

据官方OpenGL documentation ,

如果掩码中设置了除三个定义位之外的任何位,则 glClear 会生成 GL_INVALID_VALUE。

所以,我会仔细检查你的 glClear 句子。

关于java - Android 工作室 LibGDX,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41884351/

相关文章:

java - GSSAPI缺陷票

java - StackOverflowError 意外行为

java - 为什么在我们有了 ArrayLists 的情况下学习 Arrays 很重要?

android - 来自 Android 记事本示例的 Intent

java - libgdx android 不显示模型(黑屏)

java - 从 Tomcat 7 迁移到 Tomcat 9 后的 "Too many open files"

android - 渲染立方体

java - 共享首选项无法获取数据

android - API 方法 9 在 API 方法 3 Android 项目中编译,运行时错误

Java foreach 循环不必要的 float 到 int 转换