Fix BASS DllNotFoundException crash on Android startup - #209
Conversation
…undException on Android The AndroidNativeLibrary glob in osu.Android.props used backslash path separators which silently match zero files on Linux CI runners, causing libbass.so and other framework native .so files to be omitted from the APK. Also adds: - MSBuild error target to fail the build if libbass.so is missing - APK verification step in release.yml to catch missing native libs Agent-Logs-Url: https://github.com/winnerspiros/osu/sessions/1cb827b2-fc17-462a-b44c-cd932bcd649e Co-authored-by: winnerspiros <1675249+winnerspiros@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes an Android startup crash caused by missing native BASS libraries in the shipped APK by making MSBuild globbing cross-platform and adding guardrails in both MSBuild and CI.
Changes:
- Switch
osu-frameworksubmodule paths inosu.Android.propsfrom backslashes to forward slashes soAndroidNativeLibraryglobs resolve on Linux CI. - Add an MSBuild validation target intended to fail builds when required framework native libraries are missing.
- Add a CI workflow step to verify required BASS
.sofiles are present inside the produced APK before uploading/releasing.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
osu.Android.props |
Updates submodule paths to cross-platform separators and adds an MSBuild target to validate presence of framework native libs. |
.github/workflows/release.yml |
Adds an APK inspection step to fail CI if required BASS native libraries are missing from the APK. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <!-- Fail the build early if libbass.so is missing. | ||
| A missing libbass.so means the app will crash on startup with DllNotFoundException. | ||
| This catches silent glob failures (e.g. uninitialised submodule, wrong path). --> | ||
| <Target Name="ValidateFrameworkNativeLibraries" BeforeTargets="Build"> | ||
| <Error Condition="!Exists('$(MSBuildThisFileDirectory)submodules/osu-framework/osu.Framework.Android/arm64-v8a/libbass.so')" | ||
| Text="libbass.so not found in submodules/osu-framework/osu.Framework.Android/arm64-v8a/. Ensure the osu-framework submodule is initialised: git submodule update --init --recursive" /> |
There was a problem hiding this comment.
ValidateFrameworkNativeLibraries currently checks for the presence of libbass.so on disk, not that it was actually picked up by the AndroidNativeLibrary glob. The original regression (backslash glob matching zero items on Linux) would still pass this check because the file exists in the submodule while the item list is empty, and the APK would still ship without the library. Consider validating that @(AndroidNativeLibrary) contains the required libs (or at least is non-empty / contains libbass) instead of using Exists() on the file path.
| <!-- Fail the build early if libbass.so is missing. | |
| A missing libbass.so means the app will crash on startup with DllNotFoundException. | |
| This catches silent glob failures (e.g. uninitialised submodule, wrong path). --> | |
| <Target Name="ValidateFrameworkNativeLibraries" BeforeTargets="Build"> | |
| <Error Condition="!Exists('$(MSBuildThisFileDirectory)submodules/osu-framework/osu.Framework.Android/arm64-v8a/libbass.so')" | |
| Text="libbass.so not found in submodules/osu-framework/osu.Framework.Android/arm64-v8a/. Ensure the osu-framework submodule is initialised: git submodule update --init --recursive" /> | |
| <!-- Fail the build early if the framework native libraries were not picked up by the | |
| AndroidNativeLibrary glob. A missing libbass.so means the app will crash on startup | |
| with DllNotFoundException. This catches silent glob failures (e.g. wrong separators | |
| on Linux CI, uninitialised submodule, wrong path). --> | |
| <Target Name="ValidateFrameworkNativeLibraries" BeforeTargets="Build"> | |
| <PropertyGroup> | |
| <_FrameworkNativeLibraryNames>;@(AndroidNativeLibrary->'%(Filename)%(Extension)', ';');</_FrameworkNativeLibraryNames> | |
| </PropertyGroup> | |
| <Error Condition="'$(_FrameworkNativeLibraryNames)' == ';;'" | |
| Text="No AndroidNativeLibrary items were resolved from submodules/osu-framework/osu.Framework.Android/arm64-v8a/*.so. Ensure the path is correct, the osu-framework submodule is initialised (git submodule update --init --recursive), and forward slashes are used in the glob." /> | |
| <Error Condition="!$([System.String]::Copy('$(_FrameworkNativeLibraryNames)').Contains(';libbass.so;'))" | |
| Text="libbass.so was not included in @(AndroidNativeLibrary). Ensure the osu-framework submodule is initialised and the native-library glob resolves libbass.so for arm64-v8a." /> |
| NATIVE_LIBS=$(unzip -l "$APK" | grep "lib/arm64-v8a/.*\.so" || true) | ||
| echo "$NATIVE_LIBS" | ||
| echo "" | ||
|
|
||
| MISSING=0 | ||
| for LIB in libbass.so libbass_fx.so libbassmix.so; do | ||
| if echo "$NATIVE_LIBS" | grep -q "$LIB"; then | ||
| echo "✅ $LIB found" | ||
| else | ||
| echo "::error::$LIB is MISSING from the APK — the app will crash at startup (DllNotFoundException)." | ||
| MISSING=1 |
There was a problem hiding this comment.
The verification uses grep -q "$LIB" against unzip -l output; grep treats $LIB as a regex and will also match similarly-named entries (e.g. a hypothetical libbass.so.debug would satisfy libbass.so). To make this check robust, consider listing file names only (e.g. unzip -Z1) and using fixed-string / exact matching (e.g. grep -F and matching the full lib/arm64-v8a/$LIB path).
AndroidNativeLibraryglob inosu.Android.propsused backslash path separators, which silently match zero files on Linux CI runners. The build succeeds but the APK ships withoutlibbass.so, causing an immediateSystem.DllNotFoundException: basscrash inAudioManager..ctor.Root cause
Changes
osu.Android.props: Switch all submodule paths (ProjectReference + AndroidNativeLibrary) from backslash to forward slashosu.Android.props: AddValidateFrameworkNativeLibrariesMSBuild target — fails the build iflibbass.sois missing, catching uninitialised submodules or glob regressionsrelease.yml: Add post-build APK content verification step that checks forlibbass.so,libbass_fx.so,libbassmix.sobefore uploadNo changes required in osu-framework or veldrid.