我有Gradle項目和2個IDE:NetBeans和IntelliJ。 NetBeans與這個項目完美協作,沒有發現任何錯誤。 的IntelliJ但在同一項目中拋出異常:使用IntelliJ IDEA找不到文件異常
[Assets] error: com.badlogic.gdx.utils.GdxRuntimeException: File not found: ./images/enemy.atlas (Internal)
這裏是Java類:
public class Assets {
public static AssetManager assetManager;
public Assets() {
assetManager = new AssetManager();
try {
assetManager.load("./images/enemy.atlas", TextureAtlas.class);
assetManager.load("./images/buttons.atlas", TextureAtlas.class);
assetManager.load("./fonts/000.fnt", BitmapFont.class);
assetManager.load("./fonts/111.fnt", BitmapFont.class);
assetManager.setLoader(TiledMap.class, new TmxMapLoader(new InternalFileHandleResolver()));
assetManager.load("./world/level1/map.tmx", TiledMap.class);
assetManager.finishLoading();
} catch (GdxRuntimeException e) { if (Variables.isDebug) System.err.println("\n[Assets] error: " + e + "\n"); }
}
}
它是簡單的,對不對?所以,我已經通過* .gradle文件看,發現gradle這個知道到哪裏尋找我的資產:
project.ext.assetsDir = new File("../android/assets");
我已經重拍項目尤其是對IDEA(使用GDX-setup.jar),但同樣的問題就產生了。我很困惑,並要求提供建議!
P.S. AssetManager是LibGDX 1.1.0庫的一個類。
您是否可以編譯並運行簡單的「Hello,World!」 'gdx-setup.jar'在添加自己的代碼之前創建的應用程序? –
[運行新的LibGDX項目時出現「找不到文件」的可能的重複](http://stackoverflow.com/questions/22822767/file-not-found-when-running-new-libgdx-project) –