2015-10-09 57 views
3

我是新手。我使用libgdx項目生成器生成了一個新項目,一切正常。然後,我嘗試使用以下教程向庫中添加liquidfun擴展:https://github.com/finnstr/gdx-liquidfun-extension/wiki/Setup。 它編譯所有的依賴關係在編輯器中看到,但在運行時我得到這個錯誤。libgdx liquidfun集成運行時錯誤

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/badlogic/gdx/physics/box2d/World; 10-09 10:29:50.698 12790-12895/com.mygdx.game.android E/AndroidRuntime: at com.mygdx.game.MyGdxGame.createBox2DWorld(MyGdxGame.java:87)

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.badlogic.gdx.physics.box2d.World" on path: DexPathList[[zip file "/data/app/com.mygdx.game.android-1/base.apk"],nativeLibraryDirectories=[/data/app/com.mygdx.game.android-1/lib/arm, /vendor/lib, /system/lib]]

我對這個爲eclipse製作的部分感到遺憾。我不知道如何在Android Studio中進行配置。

To do so you should right click on android project and select Properties -> Java Build Path -> Add external Jar and pick core/libs/gdx-liquidfun.jar. Last step is to check this library in Order and export.

注意:我也嘗試加載本地庫,並且它們沒有發生錯誤。

static { 
     System.loadLibrary("gdx-liquidfun"); 
     System.loadLibrary("gdx-box2d"); 
    } 

回答

3

我想通了。我必須右鍵單擊jar和添加爲庫。我不得不將jar複製到android/libs。從核心/庫中的一個沒有選項作爲庫添加

+0

保存我的培根。謝謝。 –

+0

我知道這篇文章很久以前,但我有一個問題,我將gdx-liquidfun.jar複製到Android - > libs,然後右鍵單擊並添加爲庫。但我仍然得到錯誤。 –