Skip to content

Commit e0506bf

Browse files
authored
Merge pull request #210 from winnerspiros/copilot/fix-apk-crash-issue
Fix DllNotFoundException: bass — APK bundles Linux libbass.so instead of Android build
2 parents 78dbc42 + 8bf15ad commit e0506bf

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ jobs:
218218
- name: Verify native libraries in APK
219219
run: |
220220
APK="${{ steps.find_apk.outputs.apk_path }}"
221+
SUBMOD="submodules/osu-framework/osu.Framework.Android/arm64-v8a"
221222
echo "Checking APK for required native libraries..."
222223
223224
NATIVE_LIBS=$(unzip -l "$APK" | grep "lib/arm64-v8a/.*\.so" || true)
@@ -243,6 +244,24 @@ jobs:
243244
echo ""
244245
echo "All required native libraries present ✓"
245246
247+
# Verify the BASS libraries are the Android-built versions, not the Linux desktop
248+
# ones from the NativeLibs NuGet package. The Android libbass.so links against
249+
# libOpenSLES.so (Android audio API); the Linux one links against libc.so.6.
250+
echo ""
251+
echo "Verifying native library ABI compatibility..."
252+
TMPDIR=$(mktemp -d)
253+
unzip -q -o "$APK" "lib/arm64-v8a/libbass.so" -d "$TMPDIR"
254+
if readelf -d "$TMPDIR/lib/arm64-v8a/libbass.so" | grep -q "libOpenSLES.so"; then
255+
echo "✅ libbass.so is the correct Android build (links libOpenSLES.so)"
256+
else
257+
echo "::error::libbass.so in APK is NOT the Android build — it appears to be the Linux desktop version from ppy.osu.Framework.NativeLibs NuGet. The app will crash with DllNotFoundException."
258+
echo "::error::Ensure ppy.osu.Framework.NativeLibs has ExcludeAssets=native in osu.Android.props."
259+
readelf -d "$TMPDIR/lib/arm64-v8a/libbass.so" | grep NEEDED || true
260+
rm -rf "$TMPDIR"
261+
exit 1
262+
fi
263+
rm -rf "$TMPDIR"
264+
246265
- name: Upload APK artifact
247266
uses: actions/upload-artifact@v7
248267
with:

osu.Android.props

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,18 @@
8686
<ItemGroup>
8787
<!-- Use winnerspiros/osu-framework fork (net10.0-android, optimized) via submodule instead of ppy NuGet package -->
8888
<ProjectReference Include="$(MSBuildThisFileDirectory)submodules/osu-framework/osu.Framework.Android/osu.Framework.Android.csproj" />
89+
90+
<!-- Suppress native assets from the desktop NativeLibs NuGet package.
91+
ppy.osu.Framework.NativeLibs (transitive via osu.Framework.csproj) ships
92+
runtimes/linux-arm64/native/libbass.so and friends built for GNU/Linux (they link
93+
libc.so.6, libpthread.so.0, etc.). The .NET RID fallback chain for android-arm64
94+
(android-arm64 → android → unix → any) causes the Linux ARM64 .so files to leak
95+
into the APK even though the NuGet has an android/native/_._ placeholder.
96+
The result: the APK ends up with a Linux libbass.so that cannot load on Android
97+
(DllNotFoundException at startup).
98+
ExcludeAssets="native" prevents NuGet from contributing any .so files;
99+
the correct Android-built libraries are supplied by AndroidNativeLibrary below. -->
100+
<PackageReference Include="ppy.osu.Framework.NativeLibs" Version="2025.806.0-nativelibs" ExcludeAssets="native" PrivateAssets="all" />
89101
</ItemGroup>
90102

91103
<!-- Include framework native libraries (BASS audio, FFmpeg, etc.) from the submodule.

0 commit comments

Comments
 (0)