[Solved] Android crash because of BitmapData (Bug?)

Hi everyone, I’m developing a tile-based game for mobile platforms, written in Haxe (with Openfl): it works like a charm when I try it for Html5 or a desktop target (Mac OS), but it crashes in its Android version.

I don’t get errors, but I figured out the line which causes the
problem (if I remove the code from that line, the application works):

var bitm = Assets.getBitmapData("assets/grass0.png");

I already posted my situation (with logcat output) on my StackOverflow question: StackOverflow: Android crash because of BitmapData, but I’ll write a little resume:

  • The image is OK: it isn’t too big, it is included in the Android folder, and I also tried using other images, without success
  • Changing Openfl version wasn’t helpful:
  • 3.1.1: Android crash without errors
  • 3.1.3: I get /usr/lib/haxelib/openfl/3,1,3/openfl/display/Loader.hx:4: characters 7-35 : Type not found : lime.system.BackgroundWorker
  • 3.1.4: I get /usr/lib/haxelib/openfl/3,1,4/openfl/display/BitmapData.hx:5: characters 7-44 : Type not found : lime.graphics.cairo.CairoImageSurface
  • Same crash if I compile a sample project (PiratePig)
  • I get this errors only with Android targets: Html5 and desktop versions work
  • I tried to change computer, but I get same results with both Mac OS X Yosemite (Macbook Pro 13" Retina) and Windows 7
  • I tried to change device, but I get same results with both my Samsung Galaxy Tab 2 10.1" and the AVD emulator (Nexus 5)

I really hope (and think) you can help me! :smile:

To test with openfl 3.1.3 and 3.1.4 you’ll need a more recent version of lime it seems.
What version do you have?

What happens when you use lime 2.5.2 and openfl 3.2.2?

I have lime 2.4.5.

I tried to update lime (2.4.5) and openfl (3.1.4 the most recent version) on my Macbook, but haxelib says they are up to date.

However, when I compiled my project on Windows, I installed the most recent versions, so I don’t think it’s a compatibility problem (at least using openfl 3.1.1).

It happens sometime haxelib gets stuck.
You can force install the new versions haxelib install lime 2.5.2 and haxelib install openfl 3.2.2.
But in my experience haxelib is still stuck after that, needs to remove and reinstall the affected libs.

So on mac you tried openfl 3.1.1, .3 and .4 with lime 2.4.5,
and on windows lime 2.5.2 with openfl 3.2.2? Which compiles but doesn’t run?

It works!!
I manually removed the libraries:

sudo haxelib remove lime
sudo haxelib remove openfl

Then, I installed last versions manually:

sudo haxelib install lime 2.5.2
sudo haxelib install openfl 3.2.2

And it worked! Thanks so much!
P.s. On Windows I had lime 2.5.2 and openfl 3.2.2 but the program didn’t run…maybe I had to update other libraries, I don’t know.