Skip to content

Commit 341ef3c

Browse files
authored
Merge pull request #82 from winnerspiros/fix-android-startup-crash-605327588889742493
Fix Android startup crash by catching native library load failure
2 parents 9c7d4d1 + 2d41859 commit 341ef3c

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
"rollForward": "latestFeature",
55
"allowPrerelease": false
66
}
7-
}
7+
}

osu.Android/OsuGameActivity.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,14 @@ protected override void OnCreate(global::Android.OS.Bundle? savedInstanceState)
145145
{
146146
base.OnCreate(savedInstanceState);
147147

148-
global::Java.Lang.JavaSystem.LoadLibrary("osu.Android.Native");
148+
try
149+
{
150+
global::Java.Lang.JavaSystem.LoadLibrary("osu.Android.Native");
151+
}
152+
catch (Exception e)
153+
{
154+
global::Android.Util.Log.Error("OsuGameActivity", $"Failed to load native library: {e}");
155+
}
149156

150157
// OnNewIntent() only fires for an activity if it's *re-launched* while it's on top of the activity stack.
151158
// on first launch we still have to fire manually.

0 commit comments

Comments
 (0)