|
82 | 82 | Only .so files need the AssetType override — the previous broader filter |
83 | 83 | (all non-DLL, non-PDB) incorrectly reclassified signing metadata and config |
84 | 84 | files, which corrupted the APK signature (INSTALL_PARSE_FAILED_NO_CERTIFICATES). |
85 | | - Scoped to Release only to avoid interfering with Debug builds. --> |
| 85 | + Scoped to Release only to avoid interfering with Debug builds. |
| 86 | +
|
| 87 | + IMPORTANT: only Android-runtime .so files may be marked as native and packaged |
| 88 | + into the APK. ppy.osu.Framework transitively depends on ppy.osu.Framework.NativeLibs |
| 89 | + which ships desktop-only natives under runtimes/linux-arm64/native/, runtimes/osx/native/, |
| 90 | + runtimes/win-*/native/ etc. — including a bare libbass.so, libbass_fx.so, libbassmix.so |
| 91 | + for Linux. If any of those are marked AssetType=native, the .NET Android SDK packs them |
| 92 | + into lib/arm64-v8a/ of the APK, racing with (and replacing) the proper Android arm64 |
| 93 | + libbass*.so coming from ppy.osu.Framework.Android's AAR (jni/arm64-v8a/). The Linux ELF |
| 94 | + is linked against glibc and cannot be loaded by Android's bionic dynamic linker, which |
| 95 | + surfaces at startup as System.DllNotFoundException: bass from AudioManager..ctor → |
| 96 | + ManagedBass.Bass.get_DeviceCount, immediately crashing the app. --> |
86 | 97 | <Target Name="FixRuntimePackAssetTypes" AfterTargets="ResolveRuntimePackAssets;ComputeFilesToPublish;ComputeResolvedFilesToPublishList" |
87 | 98 | Condition="'$(Configuration)' == 'Release'"> |
88 | 99 | <ItemGroup> |
89 | | - <RuntimePackAsset Update="@(RuntimePackAsset)" Condition="'%(Extension)' == '.so'"> |
| 100 | + <!-- Strip desktop/iOS runtime .so files from the Android publish set entirely. |
| 101 | + Match path components for any non-Android RID known to ship .so files. |
| 102 | + Path normalisation handles both Windows (\) and Unix (/) separators. --> |
| 103 | + <ResolvedFileToPublish Remove="@(ResolvedFileToPublish)" |
| 104 | + Condition="'%(Extension)' == '.so' |
| 105 | + AND ($([System.String]::Copy('%(Identity)').Replace('\','/').Contains('/runtimes/linux-')) |
| 106 | + OR $([System.String]::Copy('%(Identity)').Replace('\','/').Contains('/runtimes/linux/')) |
| 107 | + OR $([System.String]::Copy('%(Identity)').Replace('\','/').Contains('/runtimes/osx-')) |
| 108 | + OR $([System.String]::Copy('%(Identity)').Replace('\','/').Contains('/runtimes/osx/')) |
| 109 | + OR $([System.String]::Copy('%(Identity)').Replace('\','/').Contains('/runtimes/ios-')) |
| 110 | + OR $([System.String]::Copy('%(Identity)').Replace('\','/').Contains('/runtimes/ios/')) |
| 111 | + OR $([System.String]::Copy('%(Identity)').Replace('\','/').Contains('/runtimes/maccatalyst-')) |
| 112 | + OR $([System.String]::Copy('%(Identity)').Replace('\','/').Contains('/runtimes/win-')) |
| 113 | + OR $([System.String]::Copy('%(Identity)').Replace('\','/').Contains('/runtimes/win/')) |
| 114 | + OR $([System.String]::Copy('%(Identity)').Replace('\','/').Contains('/runtimes/browser-')) |
| 115 | + OR $([System.String]::Copy('%(Identity)').Replace('\','/').Contains('/runtimes/freebsd-')))" /> |
| 116 | + <!-- Only mark Android-RID runtime pack assets as native. RuntimePackAsset items carry |
| 117 | + an explicit RuntimeIdentifier metadata, so this filter is exact. --> |
| 118 | + <RuntimePackAsset Update="@(RuntimePackAsset)" |
| 119 | + Condition="'%(Extension)' == '.so' |
| 120 | + AND $([System.String]::Copy('%(RuntimeIdentifier)').StartsWith('android'))"> |
90 | 121 | <AssetType>native</AssetType> |
91 | 122 | </RuntimePackAsset> |
| 123 | + <!-- Mark the surviving (Android-only after the Remove above) publish .so files as native |
| 124 | + so the Android SDK packs them into lib/<abi>/ rather than dropping them as data. --> |
92 | 125 | <ResolvedFileToPublish Update="@(ResolvedFileToPublish)" Condition="'%(Extension)' == '.so'"> |
93 | 126 | <AssetType>native</AssetType> |
94 | 127 | </ResolvedFileToPublish> |
|
0 commit comments