i have a problem with my game. It's a endless run shooter/platform made with LibGDX (Scene2d and box2D).
I do tests with LG G2, LG G3, Galaxy s4, desktop and android emulator and i have no one problem, but when i try to start my game on Galaxy s3 i have a very strange problem. The game crashes with no error in android and no error in android studio, simply crashes... i think its very strange because i'm developing it since a year and i always got wich error makes it crashes.
I think it's AssetManager fault because crashes often happens during loading or just finished loading (sometimes after 20-30 seconds of playing), so i tried to load less stuff and its work. I added one piece per time and at a certain point i always got a crash. In total my assets are 11mb... not so much i think. The biggest asset is the background, 2 pieces 1920*1080, near 2*70kb (yes, 70kb)...
i have in Android Studio monitor, cpu use 10~20% kernel and 10~20%user and 10~12mb memory
Here it is where the crash happens, i hope to solve soon... Thanks guys!
public class ScreenSwitcher extends Game {
private static ScreenSwitcher instance = null;
public static AssetManager manager = new AssetManager();
private ScreenSwitcher(){
}
@Override
public void create () {
loadTitle();
}
public static ScreenSwitcher getInstance(){
if(istanza==null)
istanza = new ScreenSwitcher();
return istanza;
}
public void loadTitle(){
manager.load("atlas/splash.png", Texture.class);
manager.load("atlas/mainTitle.atlas", TextureAtlas.class);
manager.load("atlas/shop.atlas", TextureAtlas.class);
manager.load("atlas/loading.atlas", TextureAtlas.class);
manager.load("atlas/duro.atlas", TextureAtlas.class);
manager.load("atlas/sfondo.atlas", TextureAtlas.class);
manager.load("atlas/nuovoRoy.atlas", TextureAtlas.class);
manager.load("atlas/altro.atlas", TextureAtlas.class);
manager.load("atlas/shipFlag.atlas", TextureAtlas.class);
manager.load("atlas/collezionabili.atlas", TextureAtlas.class);
manager.load("atlas/lucertole.atlas", TextureAtlas.class);
manager.load("atlas/lumaca.atlas", TextureAtlas.class);
manager.load("atlas/terreni.atlas", TextureAtlas.class);
manager.load("atlas/decorazione.atlas", TextureAtlas.class);
manager.load("atlas/piatte.atlas", TextureAtlas.class);
manager.load("atlas/nuvolette.atlas", TextureAtlas.class);
manager.load("atlas/pezzi.atlas", TextureAtlas.class);
manager.load("atlas/pulsanti.atlas", TextureAtlas.class);
manager.load("atlas/ragnetto.atlas", TextureAtlas.class);
manager.load("atlas/scatole.atlas", TextureAtlas.class);
manager.load("atlas/volante.atlas", TextureAtlas.class);
manager.load("atlas/volanteBonus.atlas", TextureAtlas.class);
manager.load("atlas/volantePorta.atlas", TextureAtlas.class);
manager.load("atlas/trappole.atlas", TextureAtlas.class);
manager.load("atlas/esplosione.atlas", TextureAtlas.class);
manager.load("atlas/jumpfall.atlas", TextureAtlas.class);
manager.finishLoading();
setScreen(new GameScreen());
}
Game
. You can useGdx.app.getApplicationListener()
instead to get the instance. \$\endgroup\$