Problem building/running on Android (emulator)

Hello,
I’ve got a problem with the android target.

I tried to build my first project for Android (lime test android -emulator).
I could compile without any problem, it starts the emulator with no issues but when it’s time to run I get an error.

I was thinking it could be my project issue so I’ve got the PiratePig example set up and I’ve built that.

I started the emulator (emulator -adv mytestemulator) and after I launched the test (lime test android -emulator)
No problem with the compiling but in the end the same error.

This is it:

    BUILD SUCCESSFUL
Total time: 11 seconds
3241 KB/s (6795634 bytes in 2.047s)
	pkg: /data/local/tmp/PiratePig-debug.apk
Failure [INSTALL_FAILED_CONTAINER_ERROR]
rm failed for -f, Read-only file system
Starting: Intent { act=android.intent.action.MAIN cmp=org.openfl.samples.piratepig/.MainActivity }
Error type 3
Error: Activity class {org.openfl.samples.piratepig/org.openfl.samples.piratepig.MainActivity} does not exist.
lime test android -emulator  578,84s user 19,55s system 170% cpu 5:51,46 total

Is there something I am missing?
Thank you

Looks like it failed to install to the emulator, so that’s why it fails to run the application – it doesn’t exist in the emulator yet! :smile:

Here’s a few quotes from StackOverflow:

There’s also answers about installing to the “local storage” instead of “SD card storage” for the emulator – I’m going to put in a fix now for that

Based on the latter, you could try this in the project:

<config:android install-location="auto" />

I’m just committed this as the new default, which I think may fix this (as well)

All right… Thank you very much for the response.

I’ve already read that topic on stackoverflow and I’ve already put the memory to 1024 (some people talk about keeping power of 2 numbers because sometimes it gives problem otherwise).

Also I’ve checked the SD is RW (using adb shell and check the FSs on the virtual machine).
It is read-writable, but some people suggests to force a remount. I’ve done that as well.

I’ve set the default install to SD and internal
adb shell pm setInstallLocation 1 (1 = internal, 2 = SD, 0 =Auto)
but it doesn’t matter, still the same ERROR.

I will look deeper on google, but since it is not a critical need for me now (it will be when I have to deploy anyway), I’m not in a hurry

thanks
yup

Wait, wait, wait!

Black screen but I’ve heard the music. Anyway, it doesn’t work but IT IS installed.

So yes, it was the config.
Was it ignoring the device settings?

Maybe it’s just my problem the unwriteble SD.
I will check on this and update the thread if I find out.


Just to let you know it shows this

BUILD SUCCESSFUL
Total time: 11 seconds
3167 KB/s (6795630 bytes in 2.095s)
	pkg: /data/local/tmp/PiratePig-debug.apk
Success
rm failed for -f, Read-only file system
Starting: Intent { act=android.intent.action.MAIN cmp=org.openfl.samples.piratepig/.MainActivity }
lime test android -emulator  20,31s user 1,96s system 16% cpu 2:16,87 total

What is the remove that fails because read-only system?
Still working on the SD?

Do you use at least Android API 16 in the emulator? Do you have host GPU support enabled?

This is my emulator.
It should be right

It is a black screen but the game is running, because if I try some “blind” clicks I can hear the tiles movement sound effect.

I repeat, thank you very much for your support, but don’t worry too much for me, you have probably more important things to take care of.

Cheers :wink:

1 Like

I could more information here:

You might try a newer Android API version (not sure that would help), that you might try an X86 processor for the emulator, and, I’m not sure if there might be other settings that interact with the “host GPU” setting, which is essential for OpenGL ES 2 support to work properly. Please let us know if you make progress, and helping is important :wink:

I’ll try later for sure both ways and let you know.

Also I want to take the opportunity to thank you again for the support but especially for your work. I’m having a lot of fun and challenge learning and playing with OpenFL.
Thanks a lot mate, you are a great man.

see ya later

Ok, nothing!

I’ve installed API21 and put in my project.xml

<android target-sdk-version="21" />

I’ve setup a different emulator with Google API 21 and x86 (and obviously installed IntelHAXM) and put in my project.xml

<compilerflag name="-DHXCPP_X86" if="x86" />
<architecture name="x86" if="x86" />

I compile with no issues, the app come to the emulator with the following commands
terminal1

cd to/your/androidsdk/
emulator -avd adtest

terminal2

cd to/your/project
lime test android -emulator -debug

what I get is a blank screen
I can see the background color in one screen when I “draw” a Bitmap rotated (I can see the triangles on the edges colored as the bgcolor).
I suppose every sprite get blitted black.

(sound works, touch_input works)

What can I do?

Confirm that for Genymotion (android-x86).
Text - ok, shapes - ok. But every sprite is black.

thank you restorer, this means there is a real bug with android target.
(btw very interesting this genymotion, i’m downloading it right now ;))

Just to note: bug only for x86, arm work just fine.
(I test on real device)

I’ve successfully used Android apps on an x86 emulator, though a bummer that they didn’t make that work properly for AMD processors, so totally subjective :frowning:

I’m guessing that Genymotion does not use “host GPU” quite the same as the normal emulator, and thereby must be having a GL error of some kind

It’s definitely something with Bitmaps, because text and shapes work just fine in genymotion.
Moreover:

It is raw OpenGLView. Image displayed just fine.
Also background is not an image, but fragment shader.

I wonder if there’s a way to debug, if it’s hitting an OpenGL error

I’ll try to dig into it. I guess it should be somewhere in lime legacy? Can you point me on files, where I should start looking.

Do you get any logs back on the emulator? I think Android tends to report “GL error:” at times

Currently I’m not near my computer. Will look in logcat tomorrow.