Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using a custom configuration to publish Android app #9627

Closed
manuelelucchi opened this issue Aug 24, 2022 · 9 comments
Closed

Using a custom configuration to publish Android app #9627

manuelelucchi opened this issue Aug 24, 2022 · 9 comments
Labels
area-publishing Issues with the app packaging/publishing process (ipk/apk/msix/trimming) partner/android Issues for the Android SDK platform/android 🤖 t/enhancement ☀️ New feature or request
Milestone

Comments

@manuelelucchi
Copy link

Description

I'm using a custom defined configuration in the csproj (so no standard Debug/Release but something like "Company Release/Debug Production/Staging" and, when the config is a Debug/Release one I define the following properties
image
and of course I defined DEBUG and RELEASE in DefineConstants. But when I publish using this configuration for android using dotnet publish -f:net6.0-android -c "Custom Configuration" I have no assembly optimization step and it doesn't publish the aab, only apk (even tough I have the android key store properties only when I'm in release and android)
Is there anything missing to fully support anything the default Debug/Release configurations do when building and publishing?

Steps to Reproduce

  1. Create a Maui app
  2. Create a custom configuration with alla the above properties
  3. Try to publish the aab or just compile in release
  4. No aab or optimization phase will happen

Version with bug

6.0.486 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

All versions

Did you find any workaround?

No response

Relevant log output

No response

@manuelelucchi manuelelucchi added the t/bug Something isn't working label Aug 24, 2022
@manuelelucchi
Copy link
Author

Update: I managed to force the aab format using <AndroidPackageFormat>aab</AndroidPackageFormat> but afaik it should be the default while in release and also I still don't have the assemblies optimization

@jsuarezruiz jsuarezruiz added platform/android 🤖 area-publishing Issues with the app packaging/publishing process (ipk/apk/msix/trimming) labels Aug 25, 2022
@PureWeen PureWeen added the partner/android Issues for the Android SDK label Aug 25, 2022
@PureWeen
Copy link
Member

@jonathanpeppers

@PureWeen PureWeen added this to the Backlog milestone Aug 25, 2022
@ghost
Copy link

ghost commented Aug 25, 2022

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@jonathanpeppers
Copy link
Member

This file has all the settings for Release mode:

https://github.com/xamarin/xamarin-android/blob/main/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets

I think you'd want these to match Release exactly:

  <PropertyGroup Condition=" '$(Configuration)' == 'FooRelease' ">
    <EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
    <AndroidManagedSymbols>true</AndroidManagedSymbols>
    <AndroidPackageFormats>aab;apk</AndroidPackageFormats>
    <PublishTrimmed>true</PublishTrimmed>
    <RunAOTCompilation>true</RunAOTCompilation>
    <AndroidEnableProfiledAot>true</AndroidEnableProfiledAot>
  </PropertyGroup>

There was some talk about making MSBuild have a way to "inherit" configurations to make this easier, but I don't know when/if that feature will come.

@manuelelucchi
Copy link
Author

thank you! can you please share the same for the debug?

@jonathanpeppers
Copy link
Member

jonathanpeppers commented Aug 25, 2022

Debug you could probably leave blank.

But to get hot reload you would need:

  <PropertyGroup Condition=" '$(Configuration)' == 'FooDebug' ">
    <UseInterpreter>true</UseInterpreter>
  </PropertyGroup>

@manuelelucchi
Copy link
Author

Is there anything similar for iOS?

@jonpryor jonpryor added t/enhancement ☀️ New feature or request and removed t/bug Something isn't working labels Aug 29, 2022
@jonathanpeppers
Copy link
Member

@rolfbjarne could maybe comment about the default values for iOS.

As-is, I don't see anything we can do here outside of some general solution for .NET and MSBuild. Basically we need a way to "inherit" / "extend" configurations, and it seems like something we'd need a general design for.

Closing for now as it isn't something we can really address in .NET MAUI, thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Sep 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-publishing Issues with the app packaging/publishing process (ipk/apk/msix/trimming) partner/android Issues for the Android SDK platform/android 🤖 t/enhancement ☀️ New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants