Crash on old Android versions: onResume calls View.setSystemUiVisibility, which isn't always available

Create issue
Issue #115 resolved
Alex Szpakowski created an issue

The onResume and setImmersiveMode code in GameActivity.java unconditionally calls the setSystemUiVisibility method, which was added in API level 11 whereas the listed minimum supported API level at runtime is 10 (Android 2.3.3.)

Several of the flags passed to the method are only available in higher API versions (14, 16, and 19 depending on the flag), although I'm not sure if that's important.

Comments (6)

  1. David Loomis
    Starting: Intent { act=android.intent.action.MAIN flg=0x10100000 cmp=org.love2d.android/.GameActivity } from pid 13743
    
    09-28 02:44:50.274 I/ActivityManager(13488): Start proc org.love2d.android for activity org.love2d.android/.GameActivity: pid=16481 uid=10175 gids={3003, 1015}
    
    09-28 02:44:50.321 I/WindowManager(13488): Setting rotation to 1, animFlags=1
    
    09-28 02:44:50.321 I/ActivityManager(13488): Config changed: { scale=1.0 imsi=310/4 loc=en_US touch=3 keys=2/1/2 nav=2/1 orien=2 layout=34 uiMode=17 seq=23}
    
    09-28 02:44:51.032 E/AndroidRuntime(16481): FATAL EXCEPTION: main
    
    09-28 02:44:51.032 E/AndroidRuntime(16481): java.lang.NoSuchMethodError: android.view.View.setSystemUiVisibility
    
    09-28 02:44:51.032 E/AndroidRuntime(16481):     at org.love2d.android.GameActivity$1.run(GameActivity.java:133)
    
    09-28 02:44:51.032 E/AndroidRuntime(16481):     at android.os.Handler.handleCallback(Handler.java:587)
    
    09-28 02:44:51.032 E/AndroidRuntime(16481):     at android.os.Handler.dispatchMessage(Handler.java:92)
    
    09-28 02:44:51.032 E/AndroidRuntime(16481):     at android.os.Looper.loop(Looper.java:130)
    
    09-28 02:44:51.032 E/AndroidRuntime(16481):     at android.app.ActivityThread.main(ActivityThread.java:3821)
    
    09-28 02:44:51.032 E/AndroidRuntime(16481):     at java.lang.reflect.Method.invokeNative(Native Method)
    
    09-28 02:44:51.032 E/AndroidRuntime(16481):     at java.lang.reflect.Method.invoke(Method.java:507)
    
    09-28 02:44:51.032 E/AndroidRuntime(16481):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
    
    09-28 02:44:51.032 E/AndroidRuntime(16481):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
    
    09-28 02:44:51.032 E/AndroidRuntime(16481):     at dalvik.system.NativeStart.main(Native Method)
    
    09-28 02:44:51.063 W/ActivityManager(13488):   Force finishing activity org.love2d.android/.GameActivity
    
    09-28 02:44:51.102 I/WindowManager(13488): Setting rotation to 0, animFlags=1
    
    09-28 02:44:51.118 I/ActivityManager(13488): Config changed: { scale=1.0 imsi=310/4 loc=en_US touch=3 keys=2/1/2 nav=2/1 orien=1 layout=34 uiMode=17 seq=24}
    
    09-28 02:44:51.563 W/ActivityManager(13488): Activity pause timeout for HistoryRecord{40e589c0 org.love2d.android/.GameActivity}
    
    09-28 02:44:52.899 W/ActivityManager(13488): Activity destroy timeout for HistoryRecord{407af230 org.love2d.android/.GameActivity}
    
    09-28 02:44:54.548 I/WindowManager(13488): WIN DEATH: Window{40da6550 org.love2d.android/org.love2d.android.GameActivity paused=false}
    
    09-28 02:44:54.548 I/ActivityManager(13488): Process org.love2d.android (pid 16481) has died.
    
    09-28 02:44:54.555 I/WindowManager(13488): WIN DEATH: Window{40bebe68 SurfaceView paused=false}
    
    09-28 02:44:55.868 W/ActivityManager(13488): Activity destroy timeout for HistoryRecord{40b913e0 org.love2d.android/.GameActivity}
    
    09-28 02:45:00.383 W/ActivityManager(13488): Timeout of broadcast BroadcastRecord{40d42130 android.intent.action.ACTION_POWER_CONNECTED} - receiver=android.os.BinderProxy@408fda68, started 20001ms ago
    
    09-28 02:45:00.383 W/ActivityManager(13488): Receiver during timeout: ResolveInfo{40ca4020 com.google.android.apps.youtube.app.prefetch.PrefetchService$DeviceStateReceiver p=0 o=0 m=0x108000}
    
    09-28 02:45:02.016 W/ActivityManager(13488): Activity destroy timeout for HistoryRecord{40e589c0 org.love2d.android/.GameActivity}
    
  2. Martin Felis repo owner

    Thanks for the bug request. I'll see when I get to this but will have to organize an older Android device, first :/

  3. Log in to comment