Running Love Android game with Android version <4.4.2 (API 19) fails [SOLVED]

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Chroteus
Citizen
Posts: 89
Joined: Wed Mar 20, 2013 7:30 pm

Running Love Android game with Android version <4.4.2 (API 19) fails [SOLVED]

Post by Chroteus »

Hello everyone,
Love Android's GameActivity.java uses some features that are only available in API 19 of Android and higher, resulting in following compiling errors (compiled with API 16 (Jelly Bean)):

Code: Select all

    
    [javac] C:\AndroidStuff\android-sdl22\src\org\love2d\android\GameActivity.java:132: error: cannot find symbol
    [javac]             | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
    [javac]                   ^
    [javac]   symbol:   variable SYSTEM_UI_FLAG_IMMERSIVE_STICKY
    [javac]   location: class View
    [javac] C:\AndroidStuff\android-sdl22\src\org\love2d\android\GameActivity.java:160: error: cannot find symbol
    [javac]              | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
    [javac]                         ^
    [javac]   symbol:   variable SYSTEM_UI_FLAG_IMMERSIVE_STICKY
    [javac]   location: class View
This is very bad, as a big chunk (around %15) of Android users use Jelly Bean.

Removing offending parts of the code makes the game crash on start.
I unfortunately have no idea how to program in Java, so I can't really disable these features or replace them with older versions.
If anyone managed to build a game on <19 API, let me know!

EDIT: Reading patch notes of Löve Android, it seems that 2.3.3 is the lowest version supported, so if these "immersive" features are removed, it should run.
EDIT: Updated title to reflect the (updated) problem.
Last edited by Chroteus on Fri May 13, 2016 3:47 pm, edited 2 times in total.
User avatar
slime
Solid Snayke
Posts: 3131
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Building Love Android game with API <19 fails

Post by slime »

I'm unfamiliar with Android development, but on iOS there are separate concepts of the SDK version used for building an app, and the minimum version the app is allowed to run on.

For example I build love for iOS using the iOS 9.3 SDK and allow it to run all the way down to iOS 6.0 by setting those separate settings. love's and SDL's code has various runtime branches to make sure functions that aren't in older versions don't get called in those versions.

Does android have a similar concept?

EDIT: It looks like it does: https://bitbucket.org/MartinFelis/love- ... y.java-136

On Android, the SDK version used to build the app is indeed separate from the minimum runtime SDK version (which is specified in the Manifest.xml).
User avatar
Chroteus
Citizen
Posts: 89
Joined: Wed Mar 20, 2013 7:30 pm

Re: Building Love Android game with API <19 fails

Post by Chroteus »

It seems that I was mistaken. Even if I built the project with newest API (23), it ran on Android 4.4.2 (aka KitKat aka API 19). Still, I haven't tested running it on 2.3.3 (aka Jelly Bean aka API 10) which supposedly is the lowest version supported. Won't mark it solved, until I test the .apk on an Android version lower than 4.4.2.
User avatar
Chroteus
Citizen
Posts: 89
Joined: Wed Mar 20, 2013 7:30 pm

Re: Building Love Android game with API <19 fails

Post by Chroteus »

slime wrote: On Android, the SDK version used to build the app is indeed separate from the minimum runtime SDK version (which is specified in the Manifest.xml).
The version used to build app is defined in project.properties. The version in manifest is for Google Play to allow/disallow downloading, IIRC. I'm not sure though. I don't know Android development process much as well.
User avatar
slime
Solid Snayke
Posts: 3131
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Building Love Android game with API <19 fails

Post by slime »

Yes, you should typically use the highest possible SDK version to build the app (so modern features can be used on modern android OS versions without building a specialized version of the app), and set the minimum runtime version to as low as possible.
User avatar
Chroteus
Citizen
Posts: 89
Joined: Wed Mar 20, 2013 7:30 pm

Re: Building Love Android game with API <19 fails

Post by Chroteus »

Apparently, it doesn't. Tried on 4.1.1 (API 16).

Code: Select all

No implementation found for native Lorg/libsdl/app/SDLActivity;.onNativeResize:(IIIF)V

D/AndroidRuntime( 1580): Shutting down VM

W/dalvikvm( 1580): threadid=1: thread exiting with uncaught exception (group=0xa62a0288)

W/genymotion_audio(  133): out_write() limiting sleep time 46621 to 39909

E/AndroidRuntime( 1580): FATAL EXCEPTION: main

E/AndroidRuntime( 1580): java.lang.UnsatisfiedLinkError: Native method not found: org.libsdl.app.SDLActivity.onNativeResize:(IIIF)V

E/AndroidRuntime( 1580): 	at org.libsdl.app.SDLActivity.onNativeResize(Native Method)
Here is the relevant part. It seems like a bug with SDL trying to resize the app but failing to find the needed method.
The .apk was built using latest SDK.

EDIT to prevent double posting:
Game fails to run in 4.4.2 (API 19) in AVD, too, but it runs just fine on 4.4.2 in Bluestacks player. Weird stuff.
User avatar
Chroteus
Citizen
Posts: 89
Joined: Wed Mar 20, 2013 7:30 pm

Re: Running Love Android game with Android version <4.4.2 (API 19) fails

Post by Chroteus »

An update: Just installed .apk on a real 2.3.5 device and it worked fine (albeit with low FPS). This is quite confusing. I'll mark it as solved, probably emulator issues.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 48 guests