Skip to content

Commit 183858b

Browse files
fix(android): resolve APK installation failure on Android 16
This commit addresses the "Attempt to get length of null array" error during APK installation on Android 16 (API 36) by broadening the .NET 10 native asset misclassification fix in osu.Android.props to include ResolvedFileToPublish. Additionally: - Updates PatchElfPageSize.targets to ensure local libraries in osu.Android/libs/ are patched to 16KB page alignment. - Enables default debug signing for "unsigned" workflow builds to ensure generated APKs are installable on modern devices while still being distinct from production-signed builds.
1 parent 39a8a21 commit 183858b

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ jobs:
104104
-p:AndroidSigningKeyPass=${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }}
105105
-p:AndroidSigningStorePass=${{ secrets.ANDROID_SIGNING_STORE_PASSWORD }}
106106
107-
- name: Build Android APK (unsigned)
107+
- name: Build Android APK (signed with default debug key)
108108
if: steps.keystore.outputs.has_keystore != 'true'
109109
run: >
110110
dotnet publish -c Release -p:PublishTrimmed=false -p:AndroidLinkMode=None
@@ -113,7 +113,6 @@ jobs:
113113
-p:Version=${{ steps.version.outputs.version }}
114114
-p:ApplicationDisplayVersion=${{ steps.version.outputs.version }}
115115
-p:ApplicationVersion=${{ github.run_number }}
116-
-p:AndroidKeyStore=false
117116
118117
- name: Find APK
119118
id: find_apk

build/PatchElfPageSize.targets

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,11 @@ finally
265265
Patches any 64-bit .so in the NuGet cache that has sub-16 KB LOAD alignment.
266266
The patch is idempotent — already-aligned files are skipped.
267267
-->
268-
<Target Name="PatchAndroidNativeLibPageSize" BeforeTargets="Build">
268+
<Target Name="PatchAndroidNativeLibPageSize" BeforeTargets="Build">
269269
<ItemGroup>
270-
<_NuGetNativeLibs Include="$(NuGetPackageRoot)/**/runtimes/android-*/native/*.so" />
270+
<_NativeLibs Include="$(NuGetPackageRoot)/**/*.so" />
271+
<_NativeLibs Include="$(MSBuildThisFileDirectory)../osu.Android/libs/**/*.so" />
271272
</ItemGroup>
272-
<PatchElfPageSize FilePath="%(Identity)" Condition="'@(_NuGetNativeLibs)' != ''" />
273+
<PatchElfPageSize FilePath="%(Identity)" Condition="'@(_NativeLibs)' != ''" />
273274
</Target>
274275
</Project>

osu.Android.props

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,16 @@
4242
<DisableFody>true</DisableFody>
4343
</PropertyGroup>
4444

45-
<!-- Fix for .NET 10 Android AOT misclassifying non-managed assets in runtime pack -->
46-
<Target Name="FixRuntimePackAssetTypes" AfterTargets="ResolveRuntimePackAssets">
45+
<!-- Fix for .NET 10 Android AOT misclassifying non-managed assets in runtime pack.
46+
This is critical for Android 16 (API 36) which has stricter manifest/parsing rules. -->
47+
<Target Name="FixRuntimePackAssetTypes" AfterTargets="ResolveRuntimePackAssets;ComputeFilesToPublish">
4748
<ItemGroup>
4849
<RuntimePackAsset Update="@(RuntimePackAsset)" Condition="'%(Extension)' != '.dll'">
4950
<AssetType>native</AssetType>
5051
</RuntimePackAsset>
52+
<ResolvedFileToPublish Update="@(ResolvedFileToPublish)" Condition="'%(Extension)' != '.dll' and '%(ResolvedFileToPublish.AssetType)' == ''">
53+
<AssetType>native</AssetType>
54+
</ResolvedFileToPublish>
5155
</ItemGroup>
5256
</Target>
5357
</Project>

0 commit comments

Comments
 (0)