尝试在 Genymotion 上使用 libgdx 运行 Android 游戏

Trying to run Android game using libgdx on Genymotion(尝试在 Genymotion 上使用 libgdx 运行 Android 游戏)

本文介绍了尝试在 Genymotion 上使用 libgdx 运行 Android 游戏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人使用过 libgdx 和 genymotion 吗?

Anybody experienced with libgdx and genymotion?

我正在尝试在 genymotion android 模拟器上运行 libgdx 游戏 - http://www.genymotion.com/

I'm trying to get a libgdx game running on genymotion android emulator - http://www.genymotion.com/

每次我尝试在 genymotion 上运行时,都会出现以下异常:

Everytime I try to run on genymotion I get the following exception:

java.lang.ExceptionInInitializerError
    at java.lang.Class.newInstanceImpl(Native Method)
    at java.lang.Class.newInstance(Class.java:1319)
    at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
    at android.app.ActivityThread.access$600(ActivityThread.java:130)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4745)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
    at dalvik.system.NativeStart.main(Native Method)
 Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load shared library 'gdx' for target: Linux, 32-bit
    at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:113)
    at com.badlogic.gdx.utils.GdxNativesLoader.load(GdxNativesLoader.java:34)
    at com.badlogic.gdx.backends.android.AndroidApplication.<clinit>(AndroidApplication.java:61)
    ... 15 more
 Caused by: java.lang.UnsatisfiedLinkError: Couldn't load gdx: findLibrary returned null
    at java.lang.Runtime.loadLibrary(Runtime.java:365)
    at java.lang.System.loadLibrary(System.java:535)
    at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:109)
    ... 17 more

有什么想法吗?

适用于 AVD

Android API 16libgdx 0.9.9Genymotion 1.1.0

Android API 16 libgdx 0.9.9 Genymotion 1.1.0

推荐答案

您应该尝试将 x86 本机库添加到您的 libs 文件夹中,如 这篇文章

You should try to add the x86 native libraries to your libs folder as mentioned in this post

要使用 x86 本机,只需将 x86/文件夹从 nightlies 复制到您的 Android 项目的 libs/文件夹(在 armeabi 和 armeabi-v7a 文件夹旁边).setup-ui 不会自动为您添加这些库.我暂时选择了这种方式,因为 x86 Android 设备非常罕见,而且你只会不必要地扩大 APK 的大小.

To use the x86 natives, simply copy the x86/ folder from the nightlies to your Android project’s libs/ folder (next to the armeabi and armeabi-v7a folder). The setup-ui will not add those libraries for you automatically. I opted to do it this way for the time being as x86 Android devices are super rare, and you’d just blow up the size of your APK unnecessarily.

这篇关于尝试在 Genymotion 上使用 libgdx 运行 Android 游戏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:尝试在 Genymotion 上使用 libgdx 运行 Android 游戏

基础教程推荐