2

Hi I have some problems with the texture atlas packer assetmanager from libgdx.... maybe someone had the same issue... I pack my textures in my desktop app like this ... which is running and the pack files are generated...

public class DesktopLauncher {
private static boolean rebuildAtlas = false;
private static boolean drawDebugOutline = true;

public static void main (String[] arg) {
    if (rebuildAtlas) {
        Settings settings = new Settings();
        settings.maxWidth = 1024;
        settings.maxHeight = 1024;
        settings.duplicatePadding = false;
        settings.debug = drawDebugOutline;
        TexturePacker.process(settings, "asset_raw/images", "../android/assets/images", "ppack.pack");
    }

in my assetloader class i load this or i try too ...

public void init (AssetManager assetManager) {
    this.assetManager = assetManager;

    // set asset manager error handler
    assetManager.setErrorListener(this);
    assetManager.load("../android/assets/images/ppack.pack",TextureAtlas.class);


    // start loading assets and wait until finished
    assetManager.finishLoading();
    Gdx.app.debug(TAG, "# of assets loaded: "+ assetManager.getAssetNames().size);
    for (String a : assetManager.getAssetNames())
        Gdx.app.debug(TAG, "asset: " + a);

    TextureAtlas atlas = assetManager.get(../android/assets/images/ppack.pack");

...

However i get the error :

com.mygdx.game.Assets: Couldn't load asset '../android/assets/images/ppack.pack'

But the file exist and has no strange upper lower or antoher strange symbol in its name

any suggestions ?

Ingenious
  • 21
  • 2

2 Answers2

0

solved it by setting the working directory to .../gdx/first; and loading the ppack.atlas and not the .pack

Ingenious
  • 21
  • 2
-1

You shouldn't need

"../android/assets/"

remove this part. If you get the error again check your Working Directory under Run/Debug configurations (Android Studio) and specify your assets folder.

https://github.com/libgdx/libgdx/wiki/Managing-your-assets

Alessandro Verona
  • 1,157
  • 9
  • 23
  • i changed my working directory to the asset folder but still got the error -.- Current working directory in Java : ...\gdx\first\android\assets , and the error com.mygdx.game.Assets: Couldn't load asset '/ppack.pack' com.badlogic.gdx.utils.GdxRuntimeException: File not found: \ppack.pack (Internal) – Ingenious Apr 28 '16 at 07:29
  • Are you trying to execute the desktop application? – Alessandro Verona Apr 28 '16 at 07:34
  • assetManager.load("images/ppack.pack",TextureAtlas.class); assetManager.get("images/ppack.pack",TextureAtlas.class); – TomGrill Games Apr 28 '16 at 07:35