Closed danardelean closed 5 months ago
It would be a very useful option to choose to not include these runtimes by default.
Seems like some of the last devices with x86 and Android were released by Asus in 2014 (Android 4.4), EFUN in 2015 (Android 5) and by Lenovo in November 2016 (Android 6).
Asus Memo Pad 7 ME176C https://www.gsmarena.com/asus_memo_pad_7_me176c-6412.php Asus Transformer Pad TF103C https://www.gsmarena.com/asus_transformer_pad_tf103c-6409.php Nextbook Ares 8 https://www.imei.info/phonedatabase/efun-nextbook-ares-8/ Lenovo Yoga Book X91L LTE EMEA 64GB https://phonedb.net/index.php?m=device&id=12475&c=lenovo_yoga_book_x91l_lte_emea_64gb
The last one running Android 6 which is capable of running MAUI in theory.
Edit: there are 2 devices released in 2017 with Android 6 and 7 running on Intel x86: https://phonedb.net/index.php?m=device&id=11326&c=huawei_porsche_design_pd132512_book_one https://phonedb.net/index.php?m=device&id=10306&c=panasonic_toughpad_fz-a2_mk1_wifi
How I searched: https://phonedb.net/index.php?m=device&s=query&d=detailed_specs
@danardelean: to which store are you uploading your app? If you're uploading to the Google Play Store, then you should be uploading .aab
files, not .apk
files:
From August 2021, new apps are required to publish with the Android App Bundle on Google Play.
The benefit to App Bundles (.aab
files) is that when a customer downloads their app from the Google Play Store, the .apk
that is downloaded will contain only runtime files that their device will run. If your .aab
contains both arm64 and x64 runtimes, a customer running an arm64 device will download a .apk
containing only the arm64 runtime, not the x64 runtime.
You can explicitly control which runtimes are included in the .aab
by setting the $(RuntimeIdentifiers)
MSBuild property:
dotnet build -c Release -f net8.0-android -p:RuntimeIdentifiers=android-arm64
will produce a .aab
file which contains only arm64-v8a runtime files, not x86/x64/etc.
That said, lib/*/libmonosgen-2.0.so
is not the only "runtime file" of consequence; there are also files such as assemblies.arm64_v8a.blob
that are included for all ABIs, e.g. from #19469:
.NET for Android in .NET 9 will be further altering how assemblies are packaged, removing the assemblies*.blob
files. This will in turn allow App Store .apk
downloads to be smaller, though .aab
uploads will be larger. See also:
Description
I have tested this behaviour on both Visual Studio for Mac and Visual Studio for Windows. I have only tested it on Android but it might also happen on iOS
When you Archive for publishing an .Net MAUI application in the final aab (apk) you will have the runtimes for x86 and x86-64 which are not needed . The only architecture to be included by default on Archive for publishing should be android-arm64
By dropping all the unnecessary runtimes the package will be smaller
Public API Changes
Only build for android-arm64 runtime when publishing
Intended Use-Case
Smaller packages to upload to the store