AssetManager does not load Texture.class assets from Local storage on Android
See original GitHub issueThere seems to be some issue with loading textures with AssetManager from Local storage on Android.
I try to load .png file using standard AssetManager loaders for Texture.Class. It works fine on Desktop, but on Android I keep getting the errors below. It seem that Internal file resolver is being used. LibGDX 1.6.0
My code:
textureLoaderParam = new TextureParameter();
textureLoaderParam.genMipMaps = false;
assetManager.load(path, Texture.class, textureLoaderParam);
Error:
10-07 14:15:52.791: E/AndroidRuntime(25887): FATAL EXCEPTION: GLThread 1542
10-07 14:15:52.791: E/AndroidRuntime(25887): com.badlogic.gdx.utils.GdxRuntimeException: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load dependencies of asset: local_data/fonts_gen/packed-fonts.png
10-07 14:15:52.791: E/AndroidRuntime(25887): at com.badlogic.gdx.assets.AssetManager.handleTaskError(AssetManager.java:536)
10-07 14:15:52.791: E/AndroidRuntime(25887): at com.badlogic.gdx.assets.AssetManager.update(AssetManager.java:356)
10-07 14:15:52.791: E/AndroidRuntime(25887): at com.happycroc.loader.layout.Layout.updateAssetLoading(Layout.java:125)
10-07 14:15:52.791: E/AndroidRuntime(25887): at com.happycroc.screen.loading.Screen_Loading.render(Screen_Loading.java:70)
10-07 14:15:52.791: E/AndroidRuntime(25887): at com.badlogic.gdx.Game.render(Game.java:46)
10-07 14:15:52.791: E/AndroidRuntime(25887): at com.happycroc.diving.DivingMatch.render(DivingMatch.java:104)
10-07 14:15:52.791: E/AndroidRuntime(25887): at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:422)
10-07 14:15:52.791: E/AndroidRuntime(25887): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1559)
10-07 14:15:52.791: E/AndroidRuntime(25887): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1281)
10-07 14:15:52.791: E/AndroidRuntime(25887): Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load dependencies of asset: local_data/fonts_gen/packed-fonts.png
10-07 14:15:52.791: E/AndroidRuntime(25887): at com.badlogic.gdx.assets.AssetLoadingTask.handleAsyncLoader(AssetLoadingTask.java:119)
10-07 14:15:52.791: E/AndroidRuntime(25887): at com.badlogic.gdx.assets.AssetLoadingTask.update(AssetLoadingTask.java:89)
10-07 14:15:52.791: E/AndroidRuntime(25887): at com.badlogic.gdx.assets.AssetManager.updateTask(AssetManager.java:477)
10-07 14:15:52.791: E/AndroidRuntime(25887): at com.badlogic.gdx.assets.AssetManager.update(AssetManager.java:354)
10-07 14:15:52.791: E/AndroidRuntime(25887): ... 7 more
10-07 14:15:52.791: E/AndroidRuntime(25887): Caused by: com.badlogic.gdx.utils.GdxRuntimeException: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: local_data/fonts_gen/packed-fonts.png
10-07 14:15:52.791: E/AndroidRuntime(25887): at com.badlogic.gdx.utils.async.AsyncResult.get(AsyncResult.java:46)
10-07 14:15:52.791: E/AndroidRuntime(25887): at com.badlogic.gdx.assets.AssetLoadingTask.handleAsyncLoader(AssetLoadingTask.java:117)
10-07 14:15:52.791: E/AndroidRuntime(25887): ... 10 more
10-07 14:15:52.791: E/AndroidRuntime(25887): Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: local_data/fonts_gen/packed-fonts.png
10-07 14:15:52.791: E/AndroidRuntime(25887): at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:140)
10-07 14:15:52.791: E/AndroidRuntime(25887): at com.badlogic.gdx.graphics.TextureData$Factory.loadFromFile(TextureData.java:98)
10-07 14:15:52.791: E/AndroidRuntime(25887): at com.badlogic.gdx.assets.loaders.TextureLoader.loadAsync(TextureLoader.java:69)
10-07 14:15:52.791: E/AndroidRuntime(25887): at com.badlogic.gdx.assets.loaders.TextureLoader.loadAsync(TextureLoader.java:41)
10-07 14:15:52.791: E/AndroidRuntime(25887): at com.badlogic.gdx.assets.AssetLoadingTask.call(AssetLoadingTask.java:69)
10-07 14:15:52.791: E/AndroidRuntime(25887): at com.badlogic.gdx.assets.AssetLoadingTask.call(AssetLoadingTask.java:34)
10-07 14:15:52.791: E/AndroidRuntime(25887): at com.badlogic.gdx.utils.async.AsyncExecutor$2.call(AsyncExecutor.java:58)
10-07 14:15:52.791: E/AndroidRuntime(25887): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
10-07 14:15:52.791: E/AndroidRuntime(25887): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
10-07 14:15:52.791: E/AndroidRuntime(25887): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
10-07 14:15:52.791: E/AndroidRuntime(25887): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
10-07 14:15:52.791: E/AndroidRuntime(25887): at java.lang.Thread.run(Thread.java:856)
10-07 14:15:52.791: E/AndroidRuntime(25887): Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Error reading file: local_data/fonts_gen/packed-fonts.png (Internal)
10-07 14:15:52.791: E/AndroidRuntime(25887): at com.badlogic.gdx.backends.android.AndroidFileHandle.read(AndroidFileHandle.java:77)
10-07 14:15:52.791: E/AndroidRuntime(25887): at com.badlogic.gdx.files.FileHandle.readBytes(FileHandle.java:223)
10-07 14:15:52.791: E/AndroidRuntime(25887): at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:137)
10-07 14:15:52.791: E/AndroidRuntime(25887): ... 11 more
10-07 14:15:52.791: E/AndroidRuntime(25887): Caused by: java.io.FileNotFoundException: local_data/fonts_gen/packed-fonts.png
10-07 14:15:52.791: E/AndroidRuntime(25887): at android.content.res.AssetManager.openAsset(Native Method)
10-07 14:15:52.791: E/AndroidRuntime(25887): at android.content.res.AssetManager.open(AssetManager.java:315)
10-07 14:15:52.791: E/AndroidRuntime(25887): at android.content.res.AssetManager.open(AssetManager.java:289)
10-07 14:15:52.791: E/AndroidRuntime(25887): at com.badlogic.gdx.backends.android.AndroidFileHandle.read(AndroidFileHandle.java:75)
10-07 14:15:52.791: E/AndroidRuntime(25887): ... 13 more
10-07 14:15:56.907: E/AndroidGraphics(25887): waiting for pause synchronization took too long; assuming deadlock and killing
I have tried adding leading slash to the filepath ( /local_data/fonts_gen/packed-fonts.png) - same results.
Problem looks similar to this closed issue https://github.com/libgdx/libgdx/issues/1469
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
libGDX AssetManager local file not found after successfully ...
I am developing an app for both Desktop and Android. Same behavior on both platforms. I am using the AssetManager to load images...
Read more >Integrate asset delivery (Kotlin & Java) - Android Developers
Use the steps in this guide to access your app's asset packs from your Java code. Build for Kotlin & Java. Use the...
Read more >Asset Management | Unreal Engine 4.27 Documentation
The Asset Manager handles two different types of Assets: Blueprint Classes, and non-Blueprint Assets like Levels and Data Assets (Asset instances of the ......
Read more >Asset Manager Explained | Inside Unreal - YouTube
This week on Inside Unreal, Ben Zeigler will walk us through how to use the Asset Manager to efficiently categorize, load, and ship...
Read more >Managing Assets - Earth Engine - Google Developers
To upload and manage geospatial datasets, use the Asset Manager in the Code Editor. The Asset Manager is on the Assets tab at...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
No, I did not - I just called assetManager.load(). Since the same code works fine on Desktop, I thought that it would be able to do the same for Android (like try internal location first, if it does not have the file, try local one).
Do you say that it is always required to specify separate file resolver when loading files from non-internal location?
I have the same problem… Can’t seem to figure out what I am doing wrong… http://stackoverflow.com/questions/37245293/libgdx-assetmanager-asset-not-loaded-only-on-android