.NET Android Release Build( AAB) Does Not Honor AndroidBundleConfigurationFile
Introduction
When building a .NET Android Release configuration, it is expected that the AndroidBundleConfigurationFile
property is honored, allowing developers to specify a custom BundConfig.json
file for their application. However, in this article, we will explore a scenario where the build process does not use the custom file, resulting in the app binaries not being extracted.
Background
The issue described in this article is specific to .NET Android Release builds, where the AndroidBundleConfigurationFile
property is set to a custom BundConfig.json
file. The build process is expected to use this file to configure the bundle, but instead, it uses a temporary file generated by the build process.
Affected Platform Version
The issue is observed on the following platform version:
- Android framework version: net8.0-android
- Affected platform version: VS 2022
Description
When setting the .NET MSBuild property AndroidBundleConfigurationFile
to a custom BundConfig.json
file, the build process does not use the custom file. Inspection of the build log shows the bundletool using a temp file (assuming some default build generated file) for the --config
options instead of the file specified via the AndroidBundleConfigurationFile
property.
Initially, it was thought that this issue was caused by the Uno SDK build configuration, but a simple .NET MAUI app using the default template exhibits the same behavior. The side-effect of this is that the app binaries are not getting extracted.
Steps to Reproduce
To reproduce the issue, follow these steps:
- Extract the attached zip file content, which contains a simple .NET MAUI app.
- Build and deploy the Android Release configuration to an emulator or device.
- Observe the Deploy target does not use the custom
BundleConfig.json
.
Did You Find Any Workaround?
Unfortunately, no workaround has been found for this issue.
Relevant Log Output
The relevant log output from the build process is as follows:
Skipping target "_ManifestMerger" because all output files are up-to-date with respect to the input files.
Skipping target "_ConvertCustomView" because all output files are up-to-date with respect to the input files.
Skipping target "_AddStaticResources" because all output files are up-to-date with respect to the input files.
Skipping target "_GeneratePackageManagerJava" because all output files are up-to-date with respect to the input files.
Skipping target "_GenerateAndroidAssetsDir" because all output files are up-to-date with respect to the input files.
Touching "E:\dev\camtastik\Camtastik\_build\Camtastik\Release\net8.0-android\android\bin\packaged_resources".
Skipping target "_CompileJava" because all output files are up-to-date with respect to the input files.
Skipping target "_CompileNativeAssemblySources" because all output files are up-to-date with respect to the input files.
Skipping target "_CreateApplicationSharedLibraries" because all output files are up-to-date with respect to the input files.
Skipping target "_CompileToDalvik because all output files are up-to-date with respect to the input files.
C:\Program Files (x86)\Android\openjdk\jdk-17.0.12\bin\java.exe -Xmx1G -jar "C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.147\tools\bundletool.jar" build-bundle --modules E:\dev\camtastik\Camtastik\_build\Camtastik\Release\net8.0-android\android\bin\base.zip --output E:\dev\camtastik\Camtastik\_build\Camtastik\Release\net8.0-android\android\bin\com.atlasmultimedia.Camtastik.aab --config C:\Users\cgrant1\AppData\Local\Temp\tmpCE12.tmp --metadata-file=com.android.tools.build.obfuscation/proguard.map:E:\dev\camtastik\Camtastik\_build\Release\net8.0-android\mapping.txt
Conclusion
Q: What is the AndroidBundleConfigurationFile property?
A: The AndroidBundleConfigurationFile
property is a .NET MSBuild property that allows developers to specify a custom BundConfig.json
file for their application. This file is used to configure the bundle for the Android release build.
Q: Why is the AndroidBundleConfigurationFile property not being honored?
A: The issue is that the build process is using a temporary file generated by the build process instead of the custom BundConfig.json
file specified via the AndroidBundleConfigurationFile
property.
Q: Is this issue specific to the Uno SDK build configuration?
A: No, this issue is not specific to the Uno SDK build configuration. A simple .NET MAUI app using the default template exhibits the same behavior.
Q: What are the side-effects of this issue?
A: The side-effect of this issue is that the app binaries are not getting extracted.
Q: Have you found any workaround for this issue?
A: Unfortunately, no workaround has been found for this issue.
Q: What is the relevant log output from the build process?
A: The relevant log output from the build process is as follows:
Skipping target "_ManifestMerger" because all output files are up-to-date with respect to the input files.
Skipping target "_ConvertCustomView" because all output files are up-to-date with respect to the input files.
Skipping target "_AddStaticResources" because all output files are up-to-date with respect to the input files.
Skipping target "_GeneratePackageManagerJava" because all output files are up-to-date with respect to the input files.
Skipping target "_GenerateAndroidAssetsDir" because all output files are up-to-date with respect to the input files.
Touching "E:\dev\camtastik\Camtastik\_build\Camtastik\Release\net8.0-android\android\bin\packaged_resources".
Skipping target "_CompileJava" because all output files are up-to-date with respect to the input files.
Skipping target "_CompileNativeAssemblySources" because all output files are up-to-date with respect to the input files.
Skipping target "_CreateApplicationSharedLibraries" because all output files are up-to-date with respect to the input files.
Skipping target "_CompileToDalvik because all output files are up-to-date with respect to the input files.
C:\Program Files (x86)\Android\openjdk\jdk-17.0.12\bin\java.exe -Xmx1G -jar "C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.147\tools\bundletool.jar" build-bundle --modules E:\dev\camtastik\Camtastik\_build\Camtastik\Release\net8.0-android\android\bin\base.zip --output E:\dev\camtastik\Camtastik\_build\Camtastik\Release\net8.0-android\android\bin\com.atlasmultimedia.Camtastik.aab --config C:\Users\cgrant1\AppData\Local\Temp\tmpCE12.tmp --metadata-file=com.android.tools.build.obfuscation/proguard.map:E:\dev\camtastik\Camtastik\_build\Release\net8.0-android\mapping.txt
Q: What is the net8.0-android framework version and VS 2022 platform version affected by this issue?
A: The issue is specific to the net8.0-android framework version and VS 2022 platform version.
Q: Is there any solution or fix for this issue?
A: Unfortunately, no solution or fix has been found for this issue.
Q: Can I reproduce this issue?
A: Yes, you can reproduce this issue by following the steps outlined in the article.
Q: What are the implications of this issue?
A: The implications of this issue are that the app binaries are not getting extracted, which can lead to issues with the app's functionality and performance.
Q: Can I report this issue to Microsoft?
A: Yes, you can report this issue to Microsoft through their support channels.