Skip to content

Fix BASS DllNotFoundException crash on Android startup - #209

Merged
winnerspiros merged 1 commit into
masterfrom
copilot/fix-osu-framework-crash
Apr 19, 2026
Merged

Fix BASS DllNotFoundException crash on Android startup#209
winnerspiros merged 1 commit into
masterfrom
copilot/fix-osu-framework-crash

Conversation

Copilot AI commented Apr 19, 2026

Copy link
Copy Markdown

AndroidNativeLibrary glob in osu.Android.props used backslash path separators, which silently match zero files on Linux CI runners. The build succeeds but the APK ships without libbass.so, causing an immediate System.DllNotFoundException: bass crash in AudioManager..ctor.

Root cause

<!-- Before: backslash glob silently resolves to zero files on Linux -->
<AndroidNativeLibrary Include="$(MSBuildThisFileDirectory)submodules\osu-framework\osu.Framework.Android\arm64-v8a\*.so" />

<!-- After: forward slashes work on both Windows and Linux -->
<AndroidNativeLibrary Include="$(MSBuildThisFileDirectory)submodules/osu-framework/osu.Framework.Android/arm64-v8a/*.so" />

Changes

  • osu.Android.props: Switch all submodule paths (ProjectReference + AndroidNativeLibrary) from backslash to forward slash
  • osu.Android.props: Add ValidateFrameworkNativeLibraries MSBuild target — fails the build if libbass.so is missing, catching uninitialised submodules or glob regressions
  • release.yml: Add post-build APK content verification step that checks for libbass.so, libbass_fx.so, libbassmix.so before upload

No changes required in osu-framework or veldrid.

…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>
@gitar-bot

gitar-bot Bot commented Apr 19, 2026

Copy link
Copy Markdown

Important

You are using the Gitar free plan. Upgrade to unlock code review, CI analysis, auto-apply, custom automations, and more.

Gitar

@winnerspiros
winnerspiros marked this pull request as ready for review April 19, 2026 19:03
Copilot AI review requested due to automatic review settings April 19, 2026 19:03
@winnerspiros
winnerspiros merged commit 78dbc42 into master Apr 19, 2026
1 of 15 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-framework submodule paths in osu.Android.props from backslashes to forward slashes so AndroidNativeLibrary globs 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 .so files 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.

Comment thread osu.Android.props
Comment on lines +101 to +106
<!-- 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" />

Copilot AI Apr 19, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
<!-- 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." />

Copilot uses AI. Check for mistakes.
Comment on lines +223 to +233
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

Copilot AI Apr 19, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants