简体   繁体   中英

App crashes in emulator using libgdx and tween engine

I'm currently working on a project and so far only have the splash and main screen done. I wanted to see how it would run in an Android environment so I ran it as an Android Application. The emulator booted up just fine but when it load the app or "Uploading Project-android.apk onto device 'emulator-5554' Installing Project-android.apk..." it prompts up that it "Unfortunately, Project has stopped. Here I copied the logcat for reference.

06-26 23:33:53.190: D/dalvikvm(1808): Not late-enabling CheckJNI (already     on)
06-26 23:33:53.280: D/dalvikvm(1808): Trying to load lib /data/app-    lib/com.levellabs.project.android-2/libgdx.so 0xb1fbed48
06-26 23:33:53.280: D/dalvikvm(1808): Added shared lib /data/app-    lib/com.levellabs.project.android-2/libgdx.so 0xb1fbed48
06-26 23:33:53.280: D/dalvikvm(1808): No JNI_OnLoad found in /data/app-    lib/com.levellabs.project.android-2/libgdx.so 0xb1fbed48, skipping init
06-26 23:33:53.280: D/(1808): HostConnection::get() New Host Connection     established 0xb90f3dc0, tid 1808
06-26 23:33:53.460: I/AndroidInput(1808): sensor listener setup
06-26 23:33:53.550: W/EGL_emulation(1808): eglSurfaceAttrib not implemented
06-26 23:33:53.550: D/OpenGLRenderer(1808): Enabling debug mode 0
06-26 23:33:53.560: D/(1808): HostConnection::get() New Host Connection     established 0xb910b590, tid 1823
06-26 23:33:53.600: W/GL2JNIView(1808): creating OpenGL ES 2.0 context
06-26 23:33:53.800: D/dalvikvm(1808): Trying to load lib /data/app-    lib/com.levellabs.project.android-2/libgdx.so 0xb1fbed48
06-26 23:33:53.800: D/dalvikvm(1808): Shared lib '/data/app-    lib/com.levellabs.project.android-2/libgdx.so' already loaded in same CL     0xb1fbed48
06-26 23:33:53.800: I/GL2(1808): all initialized 2
06-26 23:33:53.800: I/AndroidGraphics(1808): OGL renderer: Android Emulator     OpenGL ES Translator (GeForce GTX 770/PCIe/SSE2)
06-26 23:33:53.800: I/AndroidGraphics(1808): OGL vendor: Google (NVIDIA     Corporation)
06-26 23:33:53.800: I/AndroidGraphics(1808): OGL version: OpenGL ES 2.0 (4.5.0     NVIDIA 350.12)
06-26 23:33:53.800: I/AndroidGraphics(1808): 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
06-26 23:33:53.800: E/EGL_emulation(1808): [getAttribValue] Bad attribute idx
06-26 23:33:53.800: E/EGL_emulation(1808): tid 1823: eglGetConfigAttrib(605):     error 0x3004 (EGL_BAD_ATTRIBUTE)
06-26 23:33:53.800: E/EGL_emulation(1808): [getAttribValue] Bad attribute idx
06-26 23:33:53.800: E/EGL_emulation(1808): tid 1823: eglGetConfigAttrib(605):     error 0x3004 (EGL_BAD_ATTRIBUTE)
06-26 23:33:53.800: I/AndroidGraphics(1808): framebuffer: (5, 6, 5, 0)
06-26 23:33:53.800: I/AndroidGraphics(1808): depthbuffer: (24)
06-26 23:33:53.800: I/AndroidGraphics(1808): stencilbuffer: (0)
06-26 23:33:53.800: I/AndroidGraphics(1808): samples: (0)
06-26 23:33:53.800: I/AndroidGraphics(1808): coverage sampling: (false)
06-26 23:33:53.810: I/AndroidGraphics(1808): Managed meshes/app: { }
06-26 23:33:53.810: I/AndroidGraphics(1808): Managed textures/app: { }
06-26 23:33:53.810: I/AndroidGraphics(1808): Managed cubemap/app: { }
06-26 23:33:53.810: I/AndroidGraphics(1808): Managed shaders/app: { }
06-26 23:33:53.810: I/AndroidGraphics(1808): Managed buffers/app: { }
06-26 23:33:55.540: I/dalvikvm(1808): Could not find method     aurelienribon.tweenengine.TweenManager.update, referenced from method     com.levellabs.project.GameScreen.render
06-26 23:33:55.540: W/dalvikvm(1808): VFY: unable to resolve virtual method     369: Laurelienribon/tweenengine/TweenManager;.update (F)V
06-26 23:33:55.540: D/dalvikvm(1808): VFY: replacing opcode 0x6e at 0x0008
06-26 23:33:55.540: D/dalvikvm(1808): GC_FOR_ALLOC freed 407K, 14% free     2931K/3392K, paused 2ms, total 2ms
06-26 23:33:55.540: E/dalvikvm(1808): Could not find class     'aurelienribon.tweenengine.TweenManager', referenced from method     com.levellabs.project.GameScreen.show
06-26 23:33:55.540: W/dalvikvm(1808): VFY: unable to resolve new-instance     100     (Laurelienribon/tweenengine/TweenManager;) in Lcom/levellabs/project/GameScreen;
06-26 23:33:55.540: D/dalvikvm(1808): VFY: replacing opcode 0x22 at 0x001e
06-26 23:33:55.540: D/dalvikvm(1808): DexOpt: unable to opt direct call 0x0170     at 0x20 in Lcom/levellabs/project/GameScreen;.show
06-26 23:33:55.540: I/dalvikvm(1808): Failed resolving     Lcom/levellabs/project/tween/SpriteAccessor; interface 98     'Laurelienribon/tweenengine/TweenAccessor;'
06-26 23:33:55.540: W/dalvikvm(1808): Link of class     'Lcom/levellabs/project/tween/SpriteAccessor;' failed
06-26 23:33:55.540: D/dalvikvm(1808): DexOpt: unable to opt direct call 0x345e     at 0x29 in Lcom/levellabs/project/GameScreen;.show
06-26 23:33:55.540: I/dalvikvm(1808): Failed resolving     Lcom/levellabs/project/GameScreen$1; interface 99     'Laurelienribon/tweenengine/TweenCallback;'
06-26 23:33:55.540: W/dalvikvm(1808): Link of class     'Lcom/levellabs/project/GameScreen$1;' failed
06-26 23:33:55.540: D/dalvikvm(1808): DexOpt: unable to opt direct call 0x3434     at 0x54 in Lcom/levellabs/project/GameScreen;.show
06-26 23:33:55.660: D/dalvikvm(1808): GC_FOR_ALLOC freed 71K, 9% free     3192K/3472K, paused 2ms, total 2ms
06-26 23:33:56.120: W/dalvikvm(1808): threadid=11: thread exiting with uncaught     exception (group=0xb1cecb20)
06-26 23:33:56.120: E/AndroidRuntime(1808): FATAL EXCEPTION: GLThread 75
06-26 23:33:56.120: E/AndroidRuntime(1808): Process: com.levellabs.project.android, PID: 1808
06-26 23:33:56.120: E/AndroidRuntime(1808): java.lang.NoClassDefFoundError:     aurelienribon.tweenengine.TweenManager
06-26 23:33:56.120: E/AndroidRuntime(1808):     at com.levellabs.project.GameScreen.show(GameScreen.java:68)
06-26 23:33:56.120: E/AndroidRuntime(1808):     at com.badlogic.gdx.Game.setScreen(Game.java:61)
06-26 23:33:56.120: E/AndroidRuntime(1808):     at com.levellabs.project.Project.create(Project.java:24)
06-26 23:33:56.120: E/AndroidRuntime(1808):     at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphi    cs.java:241)
06-26 23:33:56.120: E/AndroidRuntime(1808):     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1512)
06-26 23:33:56.120: E/AndroidRuntime(1808): at  android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
06-26 23:33:56.130: I/AndroidInput(1808): sensor listener tear down
06-26 23:33:56.130: I/AndroidGraphics(1808): Managed meshes/app: { }
06-26 23:33:56.130: I/AndroidGraphics(1808): Managed textures/app: { }
06-26 23:33:56.130: I/AndroidGraphics(1808): Managed cubemap/app: { }
06-26 23:33:56.130: I/AndroidGraphics(1808): Managed shaders/app: { }
06-26 23:33:56.130: I/AndroidGraphics(1808): Managed buffers/app: { }

I think your jar file version which has some native functions does not matches the libgdx.so file version which does not have that method. Better you compile the c++ libgdx library using Android NDK to match the native functions. I got this from your error

No JNI_OnLoad found in /data/app-    lib/com.levellabs.project.android-2/libgdx.so 0xb1fbed48, skipping init
......
......
Could not find method     aurelienribon.tweenengine.TweenManager.update, referenced from method     com.levellabs.project.GameScreen.render

This means some of the native methods are not properly binded by the JNI

If you are running inside an emulator, you need corresponding .so files live libgdx.....so files

Refer this Android ndk + libgdx

If you want the ready made JAR files and .so files download here http://libgdx.badlogicgames.com/nightlies/dist/

You can see there are 11 JAR files and folders like armeabi/ armeabi-v7a/ x86/

Go through the README files for further setup needs and compilations steps.

There is also a success comment here Libgdx tween not working on Android

You can also download the Demo App https://java-universal-tween-engine.googlecode.com/files/tween-engine-demo-6.3.0.zip and check the libs folder inside it for the JAR files

If you need more help, ping me via http://chat.stackoverflow.com/rooms/50272/androidians chat room, I will help you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM