Reputation: 85
I am using Libgdx assetmanager to load UI assets. It works perfectly fine until I restart the application(Android). Here is what happens:
Gdx.app.exit()
(No errors)Error: com.badlogic.gdx.utils.GdxRuntimeException: Asset not loaded: data/GUI/packed/gui.atlas
I tried finishloading()
No luck!
I tried using finishloadingasset("data/GUI/packed/gui.atlas")
this blocks forever!
Added assetmanager.dispose()
also clear before exit. No luck!
After it is crashed, if i try to open it again it works just fine!
Please advice! Thanks
Upvotes: 0
Views: 369
Reputation: 93581
Closing an Activity in Android does not automatically clear your static references. Do not hold any static references to any OpenGL-related objects such as AssetManagers, Textures, ShaderPrograms, SpriteBatches, etc., or you risk Android reopening your game without knowing how (or that it needs) to reload them.
There might be ways around this by clearing your static references in your Activity's onCreate
method, but it's safer/easier to avoid static references altogether.
Upvotes: 2