Load a lot of .swf cause crash on old android device

Recently I tried to port my html5 games into android version. While I test it with my galaxy tabs 3 (7Inch).

My games got crashed everytime load .swf. It’s seem memory issue.

But when I tried it on new device that have higher spec than galaxy tabs 3. The game can load .swf fine.

Is there any solution to optimize it on low spec?

I already try use assets.loadlibrary or preload=true, but It’s still crashed.

My .swf total 27 with total size 18MB

Here’s the log before the app crashed.

Is this the Adobe AIR target (which uses SWF) or is it the native Android target (which decomposes SWF assets into a “SWFLite” asset library, so no SWF at runtime)?

It’s native android target (there’s no swf at runtime)

Anyway, how build to adobe air target?

You can run lime config AIR_SDK path/to/your/air/sdk then use openfl test air, or openfl test air -android

Ok, I’ll try it. But is there any solution to optimize it for native android target?

There isn’t enough information, perhaps it is a memory issue, but it doesn’t look like its using a lot of memory, or are there any other details with a stack trace, error or other details?

I can’t find any error. The app just suddenly close.

Here’s another log again :

Or do you want check my .apk?

Hmm, yeah, maybe it’s as simple as maxing out the RAM, but curious that it doesn’t really give more information

Well, What I can do for giving you more information?

I tried on nyancat example 6.0.0, I get same result too. I only include my swf folder and load it with preload=true like this :

<?xml version="1.0" encoding="utf-8"?>
<meta title="Nyan Cat" package="org.openfl.samples.nyancat" version="1.0.0" company="OpenFL" />
<app main="Main" path="Export" file="NyanCat" />

<window width="400" height="400" fps="30" />

<source path="Source" />

<haxelib name="openfl" />

<library path="Assets/library.swf" preload="true" />
<assets path="Assets" rename="assets" />

<library path="Assets/swf/hero.swf" name="hero" preload="true"/>	
<library path="Assets/swf/enemy1.swf" name="enemy1" preload="true"/>	
<library path="Assets/swf/enemy2.swf" name="enemy2" preload="true"/>	
<library path="Assets/swf/enemy3.swf" name="enemy3" preload="true"/>	
<library path="Assets/swf/enemy4.swf" name="enemy4" preload="true"/>	
<library path="Assets/swf/enemy5.swf" name="enemy5" preload="true"/>	
<library path="Assets/swf/enemy6.swf" name="enemy6" preload="true"/>	
<library path="Assets/swf/enemy7.swf" name="enemy7" preload="true"/>	
<library path="Assets/swf/enemy8.swf" name="enemy8" preload="true"/>	
<library path="Assets/swf/enemy9.swf" name="enemy9" preload="true"/>	
<library path="Assets/swf/tap.swf" name="tap" preload="true"/>	
<library path="Assets/swf/hiteffects.swf" name="hiteffects" preload="true"/>	
<library path="Assets/swf/pageenemy.swf" name="pageenemy" preload="true"/>	
<library path="Assets/swf/shield.swf" name="shield" preload="true"/>	
<library path="Assets/swf/introrakit.swf" name="introrakit" preload="true"/>	
<library path="Assets/swf/mainassemble.swf" name="mainassemble" preload="true"/>	
<library path="Assets/swf/skill1assemble.swf" name="skill1assemble" preload="true"/>	
<library path="Assets/swf/skill2assemble.swf" name="skill2assemble" preload="true"/>	
<library path="Assets/swf/skill3assemble.swf" name="skill3assemble" preload="true"/>	
<library path="Assets/swf/skill4assemble.swf" name="skill4assemble" preload="true"/>	
<library path="Assets/swf/skill5assemble.swf" name="skill5assemble" preload="true"/>	
<library path="Assets/swf/skill6assemble.swf" name="skill6assemble" preload="true"/>	
<library path="Assets/swf/skill7assemble.swf" name="skill7assemble" preload="true"/>	
<library path="Assets/swf/skill8assemble.swf" name="skill8assemble" preload="true"/>	
<library path="Assets/swf/skill9assemble.swf" name="skill9assemble" preload="true"/>	
<library path="Assets/swf/skill10assemble.swf" name="skill10assemble" preload="true"/>	
<library path="Assets/swf/readygo.swf" name="readygo" preload="true"/>	

<certificate path="D:/androidrelease.keystore" alias="myalias" password="mypassword" if="android"/>
<android minimum-sdk-version="14" target-sdk-version="23" if="android"/>				

So NyanCat works, until you preload all of the SWF-based assets, when eventually (once you reach enough) it crashes? What if you remove preload="true", and load on demand?

Yes, Nyancat works fine with based assets on low spec android device (version 4.4.2), until I adding my library swf like above. The game only launch blank white screen and suddenly close. But if I play it on high spec android device (version 6), Nyancat launch fine.

I already tried remove preload = true, the game can be launch fine until I call Assets.loadlibrary the game closed again. But on high spec device, both method working fine. So the problems seem, load a lot of .swf on low spec cause crashed.

It’s very simple to reproduce this issue. Don’t need any code. Just modify the project.xml like my example and try it on low spec android device (version 4.4.2). That’s it.

I tried 3.swf with size 3.5MB each, It’s still closed on low spec device. 1 .swf with 3.5MB work fine, the game not closed.

Note : I test it with preload=“true” on nyancat samples. I only did add tag library path on project.xml like this

<?xml version="1.0" encoding="utf-8"?>
<meta title="Nyan Cat" package="org.openfl.samples.nyancat" version="1.0.0" company="OpenFL" />
<app main="Main" path="Export" file="NyanCat" />

<window width="400" height="400" fps="30" />

<source path="Source" />

<haxelib name="openfl" />

<library path="Assets/library.swf" preload="true" />
<library path="Assets/swf/abc1.swf" preload="true" />
<library path="Assets/swf/abc2.swf" preload="true" />
<library path="Assets/swf/abc3.swf" preload="true" />
<assets path="Assets" rename="assets" />
	
<certificate path="D:/androidrelease.keystore" alias="myalias" password="mypassword" if="android"/>
<android minimum-sdk-version="14" target-sdk-version="23" if="android"/>				

And I even not call that library / use that library.