Minimum Android API Version

Is there a minimum Android version that OpenFL runs against?

Is there a default, and a way to change it (project.xml maybe?)

by default the sdk version of Android that openfl uses is 16, because some years ago 16 was the most used android version.
You may have to install that android sdk or lower, if you want your app to run on some old android phones.
but to target the sdk version that you have installed add the following lines in the project.xml file:

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

If you have installed 19, then change the number to 19.

Whatā€™s the oldest supported version? According to the Android Dashboard, 10% of users are still on 2.x (API version 8-10)

I believe version 9 works. Not sure about version 8.

We moved to Android API 9 as the minimum required version with OpenFL 1.1, I believe, when we introduced the new Android extension system and a number of other key Android feature improvements. This is 99.5% of the Android market according to that dashboard, so Iā€™m not real worried

I found this older thread which mentions that thereā€™s some issues with Android, which is why the minimum version bumped up.

If I build this with Android API level 9, what side-effects can I expect?

Itā€™s designed to work with API 9 as the minimum, but 16 (I believe) as the target. The calls to the newer code is guarded, so it will still run on an API 9 (Android 2.3) device, but it will enable specific things (such as being installed to the SD card, or being a nicer citizen with fullscreen and buttons) when running on a newer device.

This is what I wanted to know. Is there a list somewhere of OpenFL features with minimum API versions?

FYI: API 9 is officially obsoleted in favour of API 10. (c/o stack overflow)

There appears to be a problem building against API 10.

The apparent error is:

AndroidManifest.xml:14: error: Error: String types not allowed (at ā€˜configChangedā€™ with value ā€˜keyboard|keyboardHidden|orientation|screenSizeā€™).

According to this Stack Overflow post, which is correlated by the Android activity tag docs, screenSize is the problem:

screenSize & smallestScreenSize attributes are not available in SDK 10.They are been introduced in API level 13.

Even if it was possible to remove this, Iā€™m not sure what the implications are.

What do you think of all this @singmajesty ?

If you leave the target at 16 (or in this case, 13) it should still be compatible with API 9 or 10 devices

After doing some reading, I think I understand.

@ray_diama 's suggestion is actually not necessary; the target SDK version isnā€™t worth much. With the defaults, what it means in the context of OpenFL is ā€œworks up to API level 16 without compatibility features enabled, as low as API level 9.ā€

@singmajesty I assume this means you did a combination of:

  • Testing on some older OS (API 9+) ā€“ phone or emulator, and
  • Adding code that uses the Android OS version to detect/use features if available. (Thereā€™s a great blog post here on how to do this with lazy class loading to avoid errors.)

Yep, we target a newer SDK, which enables us to use a few things in the Android manifest which are specific to newer devices, it also allows us to use some features (guarded behind OS version calls) to improve how things work on newer devices, such as using the more minimal ā€œdotsā€ instead of the full on-screen home and back button icons, to focus more attention on the application.

It should also still work with Android 2.3 devices, I test on both an Android 4 and 2.3 device, usually.

Generally, the target can be as new as you want, as new you need to support any additional features that are supported, it removes some of the ā€œsafetyā€ in supporting older platforms, it wonā€™t throw compiler errors, but in testing you can ensure it does still run on older platforms.

1 Like

For a good while now, Iā€™ve been struggling to get builds to work on my Android 2.3.5 device. Using the latest OpenFL 2.2.1/Lime 2.0.4 Iā€™m still struggling. After doing

lime create openfl:DisplayingABitmap
cd DisplayingABitmap
lime test android -debug

Installs the app successfully but when I try to run it it simply just closes again.

Looking in the android logs via ā€˜monitorā€™ I get (sorry for the dump) :

01-04 07:37:51.199: I/AllAppsView(2194): startThread
01-04 07:37:51.340: I/ActivityManager(144): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.openfl.samples.displayingabitmap/.MainActivity } from pid 2194
01-04 07:37:51.450: I/AllAppsView(2194): shutDownThread
01-04 07:37:51.480: I/ActivityManager(144): Start proc org.openfl.samples.displayingabitmap for activity org.openfl.samples.displayingabitmap/.MainActivity: pid=3142 uid=10065 gids={3003}
01-04 07:37:51.590: E/Sensors(144): GsSensor: line +82 ~~~handle===0~~en==1~~!n
01-04 07:37:51.590: E/Sensors(144): GsSensor::setDelay: line +112 ~~~handle===0~~ns==1000~~!n
01-04 07:37:51.590: E/Sensors(144): GsSensor::setDelay: line +112 ~~~handle===0~~ns==-1475222695~~!n
01-04 07:37:51.640: E/asset(3142): MAS: getAppPckgAndVerCode package: org.openfl.samples.displayingabitmap === version 1
01-04 07:37:51.660: I/dalvikvm(3142): Could not find method android.view.View.setSystemUiVisibility, referenced from method org.haxe.lime.GameActivity.onStart
01-04 07:37:51.660: W/dalvikvm(3142): VFY: unable to resolve virtual method 94: Landroid/view/View;.setSystemUiVisibility (I)V
01-04 07:37:51.660: D/dalvikvm(3142): VFY: replacing opcode 0x6e at 0x0013
01-04 07:37:51.660: I/dalvikvm(3142): Could not find method android.app.Activity.onTrimMemory, referenced from method org.haxe.lime.GameActivity.onTrimMemory
01-04 07:37:51.660: W/dalvikvm(3142): VFY: unable to resolve virtual method 12: Landroid/app/Activity;.onTrimMemory (I)V
01-04 07:37:51.660: D/dalvikvm(3142): VFY: replacing opcode 0x6f at 0x0000
01-04 07:37:51.660: D/dalvikvm(3142): VFY: dead code 0x0003-0019 in Lorg/haxe/lime/GameActivity;.onTrimMemory (I)V
01-04 07:37:51.670: D/dalvikvm(3142): Trying to load lib /mnt/asec/org.openfl.samples.displayingabitmap-2/lib/libstd.so 0x40520780
01-04 07:37:51.670: D/dalvikvm(3142): Added shared lib /mnt/asec/org.openfl.samples.displayingabitmap-2/lib/libstd.so 0x40520780
01-04 07:37:51.670: D/dalvikvm(3142): No JNI_OnLoad found in /mnt/asec/org.openfl.samples.displayingabitmap-2/lib/libstd.so 0x40520780, skipping init
01-04 07:37:51.670: D/dalvikvm(3142): Trying to load lib /mnt/asec/org.openfl.samples.displayingabitmap-2/lib/libregexp.so 0x40520780
01-04 07:37:51.670: D/dalvikvm(3142): Added shared lib /mnt/asec/org.openfl.samples.displayingabitmap-2/lib/libregexp.so 0x40520780
01-04 07:37:51.670: D/dalvikvm(3142): No JNI_OnLoad found in /mnt/asec/org.openfl.samples.displayingabitmap-2/lib/libregexp.so 0x40520780, skipping init
01-04 07:37:51.670: D/dalvikvm(3142): Trying to load lib /mnt/asec/org.openfl.samples.displayingabitmap-2/lib/libzlib.so 0x40520780
01-04 07:37:51.670: D/dalvikvm(3142): Added shared lib /mnt/asec/org.openfl.samples.displayingabitmap-2/lib/libzlib.so 0x40520780
01-04 07:37:51.670: D/dalvikvm(3142): No JNI_OnLoad found in /mnt/asec/org.openfl.samples.displayingabitmap-2/lib/libzlib.so 0x40520780, skipping init
01-04 07:37:51.670: D/dalvikvm(3142): Trying to load lib /mnt/asec/org.openfl.samples.displayingabitmap-2/lib/liblime.so 0x40520780
01-04 07:37:51.700: I/AllAppsView(2194): shutDownThread
01-04 07:37:51.800: I/DEBUG(1995): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-04 07:37:51.800: I/DEBUG(1995): Build fingerprint: 'Huawei/U8510/hwu8510:2.3.5/HuaweiU8510/C364B856:user/ota-rel-keys,release-keys'
01-04 07:37:51.800: I/DEBUG(1995): pid: 3142, tid: 3142  >>> org.openfl.samples.displayingabitmap <<<
01-04 07:37:51.800: I/DEBUG(1995): signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 8104a704
01-04 07:37:51.800: I/DEBUG(1995):  r0 8145c7fc  r1 00000000  r2 8104add2  r3 ffffff01
01-04 07:37:51.800: I/DEBUG(1995):  r4 8145c7fc  r5 00000013  r6 00000004  r7 00000000
01-04 07:37:51.800: I/DEBUG(1995):  r8 aca12340  r9 0000cf50  10 41b1bc2c  fp 427d5308
01-04 07:37:51.800: I/DEBUG(1995):  ip 8145afb4  sp beaf3374  lr 8104add8  pc 8104a704  cpsr 80000010
01-04 07:37:51.800: I/DEBUG(1995):  d0  000000a043208000  d1  3ff0000043208000
01-04 07:37:51.800: I/DEBUG(1995):  d2  bfd3441350baf6de  d3  c1493000c1323800
01-04 07:37:51.800: I/DEBUG(1995):  d4  4900000040dcb000  d5  000000000006e580
01-04 07:37:51.800: I/DEBUG(1995):  d6  4515a00000000800  d7  40800000c48ee000
01-04 07:37:51.800: I/DEBUG(1995):  d8  0000000000000000  d9  0000000000000000
01-04 07:37:51.800: I/DEBUG(1995):  d10 0000000000000000  d11 0000000000000000
01-04 07:37:51.800: I/DEBUG(1995):  d12 0000000000000000  d13 0000000000000000
01-04 07:37:51.800: I/DEBUG(1995):  d14 0000000000000000  d15 0000000000000000
01-04 07:37:51.800: I/DEBUG(1995):  scr 60000010
01-04 07:37:51.890: D/GsmServiceStateTracker(232): handlePollStateResult hplmn = 23410
01-04 07:37:51.890: D/GsmServiceStateTracker(232): handlePollStateResult regplmn = 23410
01-04 07:37:51.890: D/GsmServiceStateTracker(232): handlePollStateResult plmnCustomString = null
01-04 07:37:51.890: D/GsmServiceStateTracker(232): handlePollStateResult roaming = false
01-04 07:37:51.890: D/74000 74002 GsmServiceStateTracker(232): handlePollStateResult roaming = false
01-04 07:37:51.900: I/DEBUG(1995):          #00  pc 0004a704  /mnt/asec/org.openfl.samples.displayingabitmap-2/lib/liblime.so
01-04 07:37:51.900: I/DEBUG(1995):          #01  pc 0004add4  /mnt/asec/org.openfl.samples.displayingabitmap-2/lib/liblime.so
01-04 07:37:51.900: I/DEBUG(1995): code around pc:
01-04 07:37:51.900: I/DEBUG(1995): 8104a6e4 e8bd8010 e52d4004 e59f0074 e59f4074 
01-04 07:37:51.900: I/DEBUG(1995): 8104a6f4 e3e030fe e08f0000 e3a01000 e08f4004 
01-04 07:37:51.900: I/DEBUG(1995): 8104a704 e300c1ff e1a02004 e2800f41 e2844f41 
01-04 07:37:51.900: I/DEBUG(1995): 8104a714 e4824005 e2833001 e5c21000 e153000c 
01-04 07:37:51.900: I/DEBUG(1995): 8104a724 e0802003 0a00000b e3530000 b3a01000 
01-04 07:37:51.900: I/DEBUG(1995): code around lr:
01-04 07:37:51.900: I/DEBUG(1995): 8104adb8 13a03004 e5802024 e5804010 e5803020 
01-04 07:37:51.900: I/DEBUG(1995): 8104adc8 e8bd0010 e12fff1e e92d4010 ebfffe43 
01-04 07:37:51.900: I/DEBUG(1995): 8104add8 e59f3008 e08f3003 e5830304 e8bd8010 
01-04 07:37:51.900: I/DEBUG(1995): 8104ade8 00411a18 e92d4070 e1a06002 e1a02003 
01-04 07:37:51.900: I/DEBUG(1995): 8104adf8 e5913018 e1a05001 e1a04000 e1a01006 
01-04 07:37:51.900: I/DEBUG(1995): stack:
01-04 07:37:51.900: I/DEBUG(1995):     beaf3334  afd4717c  
01-04 07:37:51.900: I/DEBUG(1995):     beaf3338  aca12340  /system/lib/libdvm.so
01-04 07:37:51.900: I/DEBUG(1995):     beaf333c  0000cf50  
01-04 07:37:51.900: I/DEBUG(1995):     beaf3340  41b1bc2c  
01-04 07:37:51.900: I/DEBUG(1995):     beaf3344  afd29867  /system/lib/libc.so
01-04 07:37:51.900: I/DEBUG(1995):     beaf3348  00000000  
01-04 07:37:51.900: I/DEBUG(1995):     beaf334c  afd1ca81  /system/lib/libc.so
01-04 07:37:51.900: I/DEBUG(1995):     beaf3350  8145c668  
01-04 07:37:51.900: I/DEBUG(1995):     beaf3354  8145c7f8  
01-04 07:37:51.900: I/DEBUG(1995):     beaf3358  00000014  
01-04 07:37:51.900: I/DEBUG(1995):     beaf335c  8124144c  /mnt/asec/org.openfl.samples.displayingabitmap-2/lib/liblime.so
01-04 07:37:51.900: I/DEBUG(1995):     beaf3360  8145c7f8  
01-04 07:37:51.900: I/DEBUG(1995):     beaf3364  8145c610  
01-04 07:37:51.900: I/DEBUG(1995):     beaf3368  df002777  
01-04 07:37:51.910: I/DEBUG(1995):     beaf336c  e3a070ad  
01-04 07:37:51.910: I/DEBUG(1995):     beaf3370  00000014  
01-04 07:37:51.910: I/DEBUG(1995): #00 beaf3374  8144594c  
01-04 07:37:51.910: I/DEBUG(1995): #01 beaf3378  8144594c  
01-04 07:37:51.910: I/DEBUG(1995):     beaf337c  b00037f5  /system/bin/linker
01-04 07:37:51.910: I/DEBUG(1995):     beaf3380  b000eba4  
01-04 07:37:51.910: I/DEBUG(1995):     beaf3384  b000eba0  
01-04 07:37:51.910: I/DEBUG(1995):     beaf3388  00002751  
01-04 07:37:51.910: I/DEBUG(1995):     beaf338c  b00038a7  /system/bin/linker
01-04 07:37:51.910: I/DEBUG(1995):     beaf3390  00465000  
01-04 07:37:51.910: I/DEBUG(1995):     beaf3394  afd00000  /system/lib/libc.so
01-04 07:37:51.910: I/DEBUG(1995):     beaf3398  0000002b  
01-04 07:37:51.910: I/DEBUG(1995):     beaf339c  b000eac0  
01-04 07:37:51.910: I/DEBUG(1995):     beaf33a0  8145add4  
01-04 07:37:51.910: I/DEBUG(1995):     beaf33a4  b000eac0  
01-04 07:37:51.910: I/DEBUG(1995):     beaf33a8  00002751  
01-04 07:37:51.910: I/DEBUG(1995):     beaf33ac  b0004f9f  /system/bin/linker
01-04 07:37:51.910: I/DEBUG(1995):     beaf33b0  0000002b  
01-04 07:37:51.910: I/DEBUG(1995):     beaf33b4  b000eb4c  
01-04 07:37:51.910: I/DEBUG(1995):     beaf33b8  b000eac0  
01-04 07:37:51.910: I/DEBUG(1995):     beaf33bc  00000006  
01-04 07:37:52.440: I/ActivityManager(144): Process org.openfl.samples.displayingabitmap (pid 3142) has died.
01-04 07:37:52.450: E/Sensors(144): GsSensor: line +82 ~~~handle===0~~en==0~~!n
01-04 07:37:52.460: D/Zygote(88): Process 3142 terminated by signal (4)
01-04 07:37:52.460: I/BootReceiver(144): Copying /data/tombstones/tombstone_00 to DropBox (SYSTEM_TOMBSTONE)
01-04 07:37:52.490: I/AllAppsView(2194): startThread
01-04 07:37:52.540: I/AllAppsView(2194): send MSG_SHUT_DOWN_THREAD message
01-04 07:37:52.540: W/InputManagerService(144): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@40850590
01-04 07:37:57.630: E/AllAppsView(2194): ++++++++++shutDownThread++++++
01-04 07:37:57.630: I/AllAppsView(2194): shutDownThread

From what youā€™ve said, I presume this should work no problem.

Any help would be appreciated.

Greg

Iā€™ll try and revive my original Galaxy S and see if it works. Have you tried basic things like ā€œDisplayingABitmapā€?

Hey,

ā€˜DisplayingABitmapā€™ is exactly what I did try and the output above is what appeared in the android logs. The app starts and quits straight away.

Cheers

Greg

I just tested here on an original Samsung Galaxy S, ā€œDisplayingABitmapā€ is working fine. On your device, two different ideas, perhaps an old version is installed, but with a newer build number, so it is treating it as newer, and not overwriting it. You could try going to ā€œSettings > Applicationsā€ and uninstalling it, then trying again. Another possibility is that the device does not support OpenGL ES 2.0, we no longer support OpenGL ES 1.1 as we did in the past

Hmm. Iā€™ve uninstalled and re-built and unfortunately got the same result. Maybe itā€™s just something with my phone - a Huawei U8510 (Ideos X3).

Running the OpenGL Extensions Viewer app it reports my phone, as I beleived is, is OpenGL ES 2.0 (with GLSL 1.0 which I understand is correct for Android).

Iā€™m gonna try running against an AVD running on 2.3.x to see if that works.

Wll let you know. Thanks for trying your device.

Greg

I tried this in an emulator for API 10 and I get these errors:

Could not find method android.view.View.setSystemUiVisibility, referenced from method org.haxe.lime.GameActivity.onStart

Could not find method android.app.Activity.onTrimMemory, referenced from method org.haxe.lime.GameActivity.onTrimMemory

This is with a new HaxeFlixel project, although I suspect OpenFL/Lime and not HaxeFlixel (yet) based on the errors.

Any thoughts @singmajesty ?

Thanks, I just put in some guards around those calls, Iā€™ve tried some other samples on my 2.3 device and they are working fine, so hopefully this is nailed.