Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Emulator does not launch LibGDX project?

Whenever i try to execute the application on the emulator, the emulator displays an error saying "Unfortunately, My libGDX Game has stopped." The application runs fine in the desktop version though.

I have the latest nightly version, ADT version 18, latest GWT, and latest version of eclipse. My Android SDK tools is version 19, while my android SDK platform-tools is version 11.

Any ideas on how to fix this?

I was following along this tutorial: LibGDX tutorial

Here is a screenshot of what i see: Emulator Screenshot

Logcat:

06-10 19:50:44.282: I/Process(1548): Sending signal. PID: 1548 SIG: 9
06-10 19:50:48.022: I/dalvikvm(1566): threadid=3: reacting to signal 3
06-10 19:50:48.152: I/dalvikvm(1566): Wrote stack traces to '/data/anr/traces.txt'
06-10 19:50:48.312: W/dalvikvm(1566): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/badlogic/gdx/backends/android/AndroidApplication;
06-10 19:50:48.312: W/dalvikvm(1566): Class init failed in newInstance call (Lcom/me/mygdxgame/MainActivity;)
06-10 19:50:48.322: D/AndroidRuntime(1566): Shutting down VM
06-10 19:50:48.332: W/dalvikvm(1566): threadid=1: thread exiting with uncaught exception (group=0xb40d5180)
06-10 19:50:48.392: E/AndroidRuntime(1566): FATAL EXCEPTION: main
06-10 19:50:48.392: E/AndroidRuntime(1566): java.lang.ExceptionInInitializerError
06-10 19:50:48.392: E/AndroidRuntime(1566):     at java.lang.Class.newInstanceImpl(Native Method)
06-10 19:50:48.392: E/AndroidRuntime(1566):     at java.lang.Class.newInstance(Class.java:1319)
06-10 19:50:48.392: E/AndroidRuntime(1566):     at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
06-10 19:50:48.392: E/AndroidRuntime(1566):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871)
06-10 19:50:48.392: E/AndroidRuntime(1566):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
06-10 19:50:48.392: E/AndroidRuntime(1566):     at android.app.ActivityThread.access$600(ActivityThread.java:123)
06-10 19:50:48.392: E/AndroidRuntime(1566):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
06-10 19:50:48.392: E/AndroidRuntime(1566):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-10 19:50:48.392: E/AndroidRuntime(1566):     at android.os.Looper.loop(Looper.java:137)
06-10 19:50:48.392: E/AndroidRuntime(1566):     at android.app.ActivityThread.main(ActivityThread.java:4424)
06-10 19:50:48.392: E/AndroidRuntime(1566):     at java.lang.reflect.Method.invokeNative(Native Method)
06-10 19:50:48.392: E/AndroidRuntime(1566):     at java.lang.reflect.Method.invoke(Method.java:511)
06-10 19:50:48.392: E/AndroidRuntime(1566):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-10 19:50:48.392: E/AndroidRuntime(1566):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-10 19:50:48.392: E/AndroidRuntime(1566):     at dalvik.system.NativeStart.main(Native Method)
06-10 19:50:48.392: E/AndroidRuntime(1566): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load gdx: findLibrary returned null
06-10 19:50:48.392: E/AndroidRuntime(1566):     at java.lang.Runtime.loadLibrary(Runtime.java:365)
06-10 19:50:48.392: E/AndroidRuntime(1566):     at java.lang.System.loadLibrary(System.java:535)
06-10 19:50:48.392: E/AndroidRuntime(1566):     at com.badlogic.gdx.utils.GdxNativesLoader.load(GdxNativesLoader.java:116)
06-10 19:50:48.392: E/AndroidRuntime(1566):     at com.badlogic.gdx.backends.android.AndroidApplication.<clinit>(AndroidApplication.java:59)
06-10 19:50:48.392: E/AndroidRuntime(1566):     ... 15 more
06-10 19:50:49.152: I/dalvikvm(1566): threadid=3: reacting to signal 3
06-10 19:50:49.192: I/dalvikvm(1566): Wrote stack traces to '/data/anr/traces.txt'
06-10 19:50:49.972: I/dalvikvm(1566): threadid=3: reacting to signal 3
06-10 19:50:50.012: I/dalvikvm(1566): Wrote stack traces to '/data/anr/traces.txt'
06-10 19:50:52.093: I/dalvikvm(1566): threadid=3: reacting to signal 3
06-10 19:50:52.112: I/dalvikvm(1566): Wrote stack traces to '/data/anr/traces.txt'
like image 717
BigBug Avatar asked Jun 10 '12 20:06

BigBug


3 Answers

If this is an ARM based emulator, you forgot to add the armeabi and armeabi-v7a folders to your Android project's libs/ folder. Please follow the setup guide here: http://code.google.com/p/libgdx/wiki/ProjectSetupNew

I̶f̶ ̶t̶h̶i̶s̶ ̶i̶s̶ ̶a̶n̶ ̶x̶8̶6̶ ̶b̶a̶s̶e̶d̶ ̶e̶m̶u̶l̶a̶t̶o̶r̶,̶ ̶t̶h̶e̶n̶ ̶i̶'̶m̶ ̶a̶f̶r̶a̶i̶d̶ ̶t̶h̶e̶r̶e̶'̶s̶ ̶n̶o̶ ̶s̶o̶l̶u̶t̶i̶o̶n̶ ̶f̶o̶r̶ ̶t̶h̶i̶s̶ ̶i̶s̶s̶u̶e̶ ̶y̶e̶t̶.̶ ̶W̶e̶ ̶d̶o̶ ̶n̶o̶t̶ ̶c̶o̶m̶p̶i̶l̶e̶ ̶f̶o̶r̶ ̶A̶n̶d̶r̶o̶i̶d̶ ̶x̶8̶6̶ ̶a̶t̶ ̶t̶h̶e̶ ̶m̶o̶m̶e̶n̶t̶.̶

Edit.- x86 is now supported

like image 99
badlogic Avatar answered Sep 21 '22 20:09

badlogic


I had the same problem... Try Android Studio -> Run -> Run 'android'. In my case it worked. If still fails I recommend to re-install libG

like image 34
Kaan Avatar answered Sep 24 '22 20:09

Kaan


If it doesn't work on the device either, try this: android-project -> properties -> java Build Path -> Order and Export. Then, click the project you've linked to (your plain java-project or desktop-project) and click the "Up"-button until it is at the very top. Make sure it's ticked [V]. I did that with the jars too, just in case, and now it runs on my device. I still get that same error on my x86 VM, because libgdx does not support x86 Android devices

like image 43
Ultroman the Tacoman Avatar answered Sep 22 '22 20:09

Ultroman the Tacoman