我想獲得一個libGDX Android遊戲,我一直在努力將其移植到另一臺筆記本電腦上。我現在使用1.5.3版本的libGDX。當我嘗試從eclipse啓動我的應用程序時,出現如下所示的錯誤:java.lang.UnsatisfiedLinkError:未找到本地方法:com.badlogic.gdx.backends.android.AndroidGL20.glGenTexture :()
02-11 21:21:35.519: E/Trace(7276): error opening trace file: No such file or directory (2)
02-11 21:21:36.019: E/dalvikvm(7276): Could not find class 'android.support.v4.app.FragmentActivity', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.showErrorDialogFragment
02-11 21:21:36.019: E/dalvikvm(7276): Could not find class 'android.support.v4.app.FragmentActivity', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.showErrorDialogFragment
02-11 21:21:36.820: E/AndroidRuntime(7276): FATAL EXCEPTION: GLThread 11304
02-11 21:21:36.820: E/AndroidRuntime(7276): java.lang.UnsatisfiedLinkError: Native method not found: com.badlogic.gdx.backends.android.AndroidGL20.glGenTexture:()I
02-11 21:21:36.820: E/AndroidRuntime(7276): at com.badlogic.gdx.backends.android.AndroidGL20.glGenTexture(Native Method)
02-11 21:21:36.820: E/AndroidRuntime(7276): at com.badlogic.gdx.graphics.GLTexture.createGLHandle(GLTexture.java:197)
02-11 21:21:36.820: E/AndroidRuntime(7276): at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:123)
02-11 21:21:36.820: E/AndroidRuntime(7276): at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:103)
02-11 21:21:36.820: E/AndroidRuntime(7276): at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:95)
02-11 21:21:36.820: E/AndroidRuntime(7276): at com.mypkg.mygame.screens.MainMenu.show(MainMenu.java:41)
02-11 21:21:36.820: E/AndroidRuntime(7276): at com.badlogic.gdx.Game.setScreen(Game.java:61)
02-11 21:21:36.820: E/AndroidRuntime(7276): at com.mypkg.mygame.mygame.create(mygame.java:20)
02-11 21:21:36.820: E/AndroidRuntime(7276): at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:241)
02-11 21:21:36.820: E/AndroidRuntime(7276): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1505)
02-11 21:21:36.820: E/AndroidRuntime(7276): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
這是產生此錯誤的代碼位。
public void show() {
FileHandle gdxfile = Gdx.files.internal("data/title.png");
Texture t = new Texture(gdxfile); // this is line where my app crashes
相同的代碼工作正常,我的其他的筆記本電腦。 任何幫助表示讚賞。
它說'本地方法沒有找到',所以你把libgdx的這麼你的apk,它是否支持你的ABI? – Mine 2015-02-12 06:39:01
這是一個很好的問題,我如何判斷我是否將libgdx的co放在了我的apk中?我不知道ABI是什麼?你可以解釋嗎?謝謝! – 2015-02-12 06:45:04
我不知道libgdx,但是使用JNI的庫應該爲不同的CPU(Native CPU ABI)使用.so文件構建。 .so文件應打包到您應用的apk文件中,以便Android可以爲您的應用加載庫。 – Mine 2015-02-12 06:58:47