Skip to content

Commit adb802d

Browse files
authored
Merge pull request #158 from winnerspiros/fix/android-build-optimization-13159275510640310113
Fix Android build and optimize trimming
2 parents 099f72d + 5327d2a commit adb802d

3 files changed

Lines changed: 12 additions & 8 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,11 @@ jobs:
8686
8787
- name: Build Android APK
8888
run: |
89-
# Use optimized publish command with aggressive trimming and RID-specific build
89+
# Use optimized publish command with aggressive trimming (defined in project props)
9090
PUBLISH_CMD="dotnet publish -c Release osu.Android/osu.Android.csproj -f net10.0-android -r android-arm64 --self-contained true \
9191
-p:Version=${{ steps.version.outputs.version }} \
9292
-p:ApplicationDisplayVersion=${{ steps.version.outputs.version }} \
9393
-p:ApplicationVersion=${{ github.run_number }} \
94-
-p:PublishTrimmed=true -p:TrimMode=link -p:AndroidLinkMode=SdkOnly \
95-
-p:AndroidEnableResourceShrinking=true \
96-
-p:MtouchLink=Full \
9794
-p:AndroidCreatePackagePerAbi=false"
9895
9996
if [ "${{ steps.keystore.outputs.has_keystore }}" == "true" ]; then
@@ -118,7 +115,6 @@ jobs:
118115
fi
119116
120117
echo "Optimizing APK using zipalign if available..."
121-
# zipalign is usually in the build-tools directory of Android SDK
122118
ZIPALIGN=$(find $ANDROID_HOME/build-tools -name zipalign | sort -r | head -1)
123119
if [ -n "$ZIPALIGN" ]; then
124120
$ZIPALIGN -v 4 "$APK" "${APK}.aligned"

osu.Android.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
<AndroidEnableProfiledAot>true</AndroidEnableProfiledAot>
2626
<SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>
2727
<PublishTrimmed>true</PublishTrimmed>
28-
<TrimMode>link</TrimMode>
29-
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
28+
<TrimMode>full</TrimMode>
29+
<AndroidLinkMode>Full</AndroidLinkMode>
3030
<AndroidEnableResourceShrinking>true</AndroidEnableResourceShrinking>
3131
</PropertyGroup>
3232
<ItemGroup>

osu.Android/Linker.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<linker>
2-
<assembly fullname="System.Private.CoreLib">
2+
<assembly fullname="System.Runtime">
33
<type fullname="System.Collections.Generic.PriorityQueue`2" preserve="all" />
44
</assembly>
5+
<assembly fullname="MessagePack">
6+
<type fullname="MessagePack.Internal.PriorityQueue`1" preserve="all" />
7+
<type fullname="MessagePack.Resolvers.DynamicUnionResolver" preserve="all" />
8+
<type fullname="MessagePack.Resolvers.DynamicObjectResolver" preserve="all" />
9+
</assembly>
10+
<assembly fullname="AutoMapper">
11+
<type fullname="AutoMapper.Configuration.ProxyBase" preserve="all" />
12+
</assembly>
513
</linker>

0 commit comments

Comments
 (0)