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

[One .NET] select defaults for App Bundles #6059

Closed
jonathanpeppers opened this issue Jun 30, 2021 · 4 comments · Fixed by #6087
Closed

[One .NET] select defaults for App Bundles #6059

jonathanpeppers opened this issue Jun 30, 2021 · 4 comments · Fixed by #6087
Assignees
Labels
Area: App+Library Build Issues when building Library projects or Application projects.
Milestone

Comments

@jonathanpeppers
Copy link
Member

jonathanpeppers commented Jun 30, 2021

August 2021, Android App Bundles will be required for new apps on Google Play:

https://android-developers.googleblog.com/2020/11/new-android-app-bundle-and-target-api.html

In .NET 6, we should:

  1. Release builds with a blank $(AndroidPackageFormat) should default to aab.
  2. Come up with a new property that generates .apk files in addition to .aab. Enable this by default for release builds.

For no. 2 to work, we should be able to generate the .aab as usual, then add a separate step for generating a "fat" .apk file for all architectures. This way apps could submit builds to other stores than Google Play, which might not support App Bundles yet.

@jonathanpeppers jonathanpeppers added Area: App+Library Build Issues when building Library projects or Application projects. needs-triage Issues that need to be assigned. labels Jun 30, 2021
@jonathanpeppers jonathanpeppers self-assigned this Jun 30, 2021
@jonathanpeppers jonathanpeppers removed the needs-triage Issues that need to be assigned. label Jun 30, 2021
@jonathanpeppers jonathanpeppers added this to the .NET 6 milestone Jun 30, 2021
@AmrAlSayed0
Copy link

AmrAlSayed0 commented Jun 30, 2021

Could you make <AndroidPackageFormat>aab;apk</AndroidPackageFormat> work? No need for another property.

@dellis1972
Copy link
Contributor

Could you make <AndroidPackageFormat>aab;apk</AndroidPackageFormat> work? No need for another property.

If we followed the same convention as .net 6 it would be AndroidPackageFormats . I kinda like this idea. But it would mean IDE changes... mind you either way, this will need IDE changes.

@dellis1972
Copy link
Contributor

@joj any thoughts on this from the IDE perspective?

dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Jul 14, 2021
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Jul 15, 2021
@dellis1972
Copy link
Contributor

PR #6087 has this in progress. Changing over completely to AndroidPackageFormats would have resulted in a rather large PR. Much of our build system is dependent on targeting a single format.

So we are going to introduce a new property AndroidAdditionalPackageFormats. This should have a value of apk.
And when AndroidPackageFormat is set to aab and AndroidAdditionalPackageFormats set to apk we will use
bundle-tool to generate a universal apk from the aab file.

dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Jul 16, 2021
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Jul 19, 2021
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Jul 21, 2021
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Jul 22, 2021
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Jul 28, 2021
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Jul 30, 2021
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Aug 2, 2021
Fixes dotnet#6059

Users will probably want to target more than one App Store. Google is now requiring the `aab` format for
Google Play Store uploads. Unfortunately this package format is not compatible with other stores.
Users can build their app twice producing an `aab` for one build and `apk` for another, but we should
try to make this a bit easier.

`bundle-tool` has the ability to create a universal apk from the `aab` file. So lets make use of that to
generate one along side the `aab`. We are introducing a new property `AndroidPackageFormats`.
Under .net 6 this will have a value of `aab;apk` by default for Release builds, for Legacy it will be
empty.

If `AndroidPackageFormats` is specified and `AndroidPackageFormat` is empty we will use the
values in `AndroidPackageFormats` to populate `AndroidPackageFormat`. If none of these values
are provided the `AndroidPackageFormat` will still default to `apk` as it has always done.

The following setting will produce both an `aab` and an `apk`.
```
<PropertyGroup>
  <AndroidPackageFormats>aab;apk</AndroidPackageFormats>
</PropertyGroup>
```

This will produce just an `aab`

```
<PropertyGroup>
  <AndroidPackageFormats>aab</AndroidPackageFormats>
</PropertyGroup>
```

and this will produce just an `apk`

```
<PropertyGroup>
  <AndroidPackageFormats>apk</AndroidPackageFormats>
</PropertyGroup>
```

For .net 6 users this will be enabled by default for Release builds. For legacy users they will need
to define the property manually.
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Aug 5, 2021
Fixes dotnet#6059

Users will probably want to target more than one App Store. Google is now requiring the `aab` format for
Google Play Store uploads. Unfortunately this package format is not compatible with other stores.
Users can build their app twice producing an `aab` for one build and `apk` for another, but we should
try to make this a bit easier.

`bundle-tool` has the ability to create a universal apk from the `aab` file. So lets make use of that to
generate one along side the `aab`. We are introducing a new property `AndroidPackageFormats`.
Under .net 6 this will have a value of `aab;apk` by default for Release builds, for Legacy it will be
empty.

If `AndroidPackageFormats` is specified and `AndroidPackageFormat` is empty we will use the
values in `AndroidPackageFormats` to populate `AndroidPackageFormat`. If none of these values
are provided the `AndroidPackageFormat` will still default to `apk` as it has always done.

The following setting will produce both an `aab` and an `apk`.
```
<PropertyGroup>
  <AndroidPackageFormats>aab;apk</AndroidPackageFormats>
</PropertyGroup>
```

This will produce just an `aab`

```
<PropertyGroup>
  <AndroidPackageFormats>aab</AndroidPackageFormats>
</PropertyGroup>
```

and this will produce just an `apk`

```
<PropertyGroup>
  <AndroidPackageFormats>apk</AndroidPackageFormats>
</PropertyGroup>
```

For .net 6 users this will be enabled by default for Release builds. For legacy users they will need
to define the property manually.
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Aug 9, 2021
Fixes dotnet#6059

Users will probably want to target more than one App Store. Google is now requiring the `aab` format for
Google Play Store uploads. Unfortunately this package format is not compatible with other stores.
Users can build their app twice producing an `aab` for one build and `apk` for another, but we should
try to make this a bit easier.

`bundle-tool` has the ability to create a universal apk from the `aab` file. So lets make use of that to
generate one along side the `aab`. We are introducing a new property `AndroidPackageFormats`.
Under .net 6 this will have a value of `aab;apk` by default for Release builds, for Legacy it will be
empty.

If `AndroidPackageFormats` is specified and `AndroidPackageFormat` is empty we will use the
values in `AndroidPackageFormats` to populate `AndroidPackageFormat`. If none of these values
are provided the `AndroidPackageFormat` will still default to `apk` as it has always done.

The following setting will produce both an `aab` and an `apk`.
```
<PropertyGroup>
  <AndroidPackageFormats>aab;apk</AndroidPackageFormats>
</PropertyGroup>
```

This will produce just an `aab`

```
<PropertyGroup>
  <AndroidPackageFormats>aab</AndroidPackageFormats>
</PropertyGroup>
```

and this will produce just an `apk`

```
<PropertyGroup>
  <AndroidPackageFormats>apk</AndroidPackageFormats>
</PropertyGroup>
```

For .net 6 users this will be enabled by default for Release builds. For legacy users they will need
to define the property manually.
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Aug 11, 2021
Fixes dotnet#6059

Users will probably want to target more than one App Store. Google is now requiring the `aab` format for
Google Play Store uploads. Unfortunately this package format is not compatible with other stores.
Users can build their app twice producing an `aab` for one build and `apk` for another, but we should
try to make this a bit easier.

`bundle-tool` has the ability to create a universal apk from the `aab` file. So lets make use of that to
generate one along side the `aab`. We are introducing a new property `AndroidPackageFormats`.
Under .net 6 this will have a value of `aab;apk` by default for Release builds, for Legacy it will be
empty.

If `AndroidPackageFormats` is specified and `AndroidPackageFormat` is empty we will use the
values in `AndroidPackageFormats` to populate `AndroidPackageFormat`. If none of these values
are provided the `AndroidPackageFormat` will still default to `apk` as it has always done.

The following setting will produce both an `aab` and an `apk`.
```
<PropertyGroup>
  <AndroidPackageFormats>aab;apk</AndroidPackageFormats>
</PropertyGroup>
```

This will produce just an `aab`

```
<PropertyGroup>
  <AndroidPackageFormats>aab</AndroidPackageFormats>
</PropertyGroup>
```

and this will produce just an `apk`

```
<PropertyGroup>
  <AndroidPackageFormats>apk</AndroidPackageFormats>
</PropertyGroup>
```

For .net 6 users this will be enabled by default for Release builds. For legacy users they will need
to define the property manually.
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Aug 13, 2021
Fixes dotnet#6059

Users will probably want to target more than one App Store. Google is now requiring the `aab` format for
Google Play Store uploads. Unfortunately this package format is not compatible with other stores.
Users can build their app twice producing an `aab` for one build and `apk` for another, but we should
try to make this a bit easier.

`bundle-tool` has the ability to create a universal apk from the `aab` file. So lets make use of that to
generate one along side the `aab`. We are introducing a new property `AndroidPackageFormats`.
Under .net 6 this will have a value of `aab;apk` by default for Release builds, for Legacy it will be
empty.

If `AndroidPackageFormats` is specified and `AndroidPackageFormat` is empty we will use the
values in `AndroidPackageFormats` to populate `AndroidPackageFormat`. If none of these values
are provided the `AndroidPackageFormat` will still default to `apk` as it has always done.

The following setting will produce both an `aab` and an `apk`.
```
<PropertyGroup>
  <AndroidPackageFormats>aab;apk</AndroidPackageFormats>
</PropertyGroup>
```

This will produce just an `aab`

```
<PropertyGroup>
  <AndroidPackageFormats>aab</AndroidPackageFormats>
</PropertyGroup>
```

and this will produce just an `apk`

```
<PropertyGroup>
  <AndroidPackageFormats>apk</AndroidPackageFormats>
</PropertyGroup>
```

For .net 6 users this will be enabled by default for Release builds. For legacy users they will need
to define the property manually.
@jonpryor jonpryor added this to Backlog in .NET 6 Aug 18, 2021
@jonpryor jonpryor moved this from Backlog to RC-1 in .NET 6 Aug 18, 2021
@jonpryor jonpryor removed this from RC-1 in .NET 6 Aug 18, 2021
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Aug 20, 2021
Fixes dotnet#6059

Users will probably want to target more than one App Store. Google is now requiring the `aab` format for
Google Play Store uploads. Unfortunately this package format is not compatible with other stores.
Users can build their app twice producing an `aab` for one build and `apk` for another, but we should
try to make this a bit easier.

`bundle-tool` has the ability to create a universal apk from the `aab` file. So lets make use of that to
generate one along side the `aab`. We are introducing a new property `AndroidPackageFormats`.
Under .net 6 this will have a value of `aab;apk` by default for Release builds, for Legacy it will be
empty.

If `AndroidPackageFormats` is specified and `AndroidPackageFormat` is empty we will use the
values in `AndroidPackageFormats` to populate `AndroidPackageFormat`. If none of these values
are provided the `AndroidPackageFormat` will still default to `apk` as it has always done.

The following setting will produce both an `aab` and an `apk`.
```
<PropertyGroup>
  <AndroidPackageFormats>aab;apk</AndroidPackageFormats>
</PropertyGroup>
```

This will produce just an `aab`

```
<PropertyGroup>
  <AndroidPackageFormats>aab</AndroidPackageFormats>
</PropertyGroup>
```

and this will produce just an `apk`

```
<PropertyGroup>
  <AndroidPackageFormats>apk</AndroidPackageFormats>
</PropertyGroup>
```

For .net 6 users this will be enabled by default for Release builds. For legacy users they will need
to define the property manually.
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Aug 25, 2021
Fixes dotnet#6059

Users will probably want to target more than one App Store. Google is now requiring the `aab` format for
Google Play Store uploads. Unfortunately this package format is not compatible with other stores.
Users can build their app twice producing an `aab` for one build and `apk` for another, but we should
try to make this a bit easier.

`bundle-tool` has the ability to create a universal apk from the `aab` file. So lets make use of that to
generate one along side the `aab`. We are introducing a new property `AndroidPackageFormats`.
Under .net 6 this will have a value of `aab;apk` by default for Release builds, for Legacy it will be
empty.

If `AndroidPackageFormats` is specified and `AndroidPackageFormat` is empty we will use the
values in `AndroidPackageFormats` to populate `AndroidPackageFormat`. If none of these values
are provided the `AndroidPackageFormat` will still default to `apk` as it has always done.

The following setting will produce both an `aab` and an `apk`.
```
<PropertyGroup>
  <AndroidPackageFormats>aab;apk</AndroidPackageFormats>
</PropertyGroup>
```

This will produce just an `aab`

```
<PropertyGroup>
  <AndroidPackageFormats>aab</AndroidPackageFormats>
</PropertyGroup>
```

and this will produce just an `apk`

```
<PropertyGroup>
  <AndroidPackageFormats>apk</AndroidPackageFormats>
</PropertyGroup>
```

For .net 6 users this will be enabled by default for Release builds. For legacy users they will need
to define the property manually.
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Aug 27, 2021
Fixes dotnet#6059

Users will probably want to target more than one App Store. Google is now requiring the `aab` format for
Google Play Store uploads. Unfortunately this package format is not compatible with other stores.
Users can build their app twice producing an `aab` for one build and `apk` for another, but we should
try to make this a bit easier.

`bundle-tool` has the ability to create a universal apk from the `aab` file. So lets make use of that to
generate one along side the `aab`. We are introducing a new property `AndroidPackageFormats`.
Under .net 6 this will have a value of `aab;apk` by default for Release builds, for Legacy it will be
empty.

If `AndroidPackageFormats` is specified and `AndroidPackageFormat` is empty we will use the
values in `AndroidPackageFormats` to populate `AndroidPackageFormat`. If none of these values
are provided the `AndroidPackageFormat` will still default to `apk` as it has always done.

The following setting will produce both an `aab` and an `apk`.
```
<PropertyGroup>
  <AndroidPackageFormats>aab;apk</AndroidPackageFormats>
</PropertyGroup>
```

This will produce just an `aab`

```
<PropertyGroup>
  <AndroidPackageFormats>aab</AndroidPackageFormats>
</PropertyGroup>
```

and this will produce just an `apk`

```
<PropertyGroup>
  <AndroidPackageFormats>apk</AndroidPackageFormats>
</PropertyGroup>
```

For .net 6 users this will be enabled by default for Release builds. For legacy users they will need
to define the property manually.
jonpryor pushed a commit that referenced this issue Aug 28, 2021
Fixes: #6059

Context: https://android-developers.googleblog.com/2020/11/new-android-app-bundle-and-target-api.html
Context: https://blogs.windows.com/windowsexperience/2021/06/24/building-a-new-open-microsoft-store-on-windows-11/
Context: https://developer.amazon.com/blogs/appstore/post/50b1ca0f-bbec-48ec-9eea-3c395efb8f9f/amazon-appstore-to-support-android-app-bundle

The Google Play Store requires Android App Bundles (`.aab` files) for
all new apps as of August 2021, and for all apps in November 2021.
Meanwhile, Microsoft has announced that Windows 11 will support
running Android apps and installing them via the Amazon Appstore,
which currently only supports `.apk` file uploads.

While a Xamarin.Android user could build their app twice, changing
the [`$(AndroidPackageFormat)`][0] between each build, we feel it
would be "better" -- faster, more convenient -- if a single
`SignAndroidPackage` target invocation could produce *both* `.aab`
and `.apk` outputs.

[`bundletool.jar`][1] has the ability to create a universal `.apk`
from the `.aab` file.

Introduce support for a new `$(AndroidPackageFormats)` (plural)
MSBuild property, which is a `;`-delimited sequence of
`$(AndroidPackageFormat)` values to produce as build outputs.
For example, if `$(AndroidPackageFormats)`=`aab;apk`, then *both*
`.aab` and `.apk` outputs will be produced.

	<PropertyGroup>
	  <AndroidPackageFormats>aab;apk</AndroidPackageFormats>
	</PropertyGroup>

The `.apk` output will be generated from the `.aab` file, ensuring
consistency.

In .NET 6 Debug configuration builds, `$(AndroidPackageFormats)` will
default to `.apk`, as this behaves better with Fast Deployment and
developer productivity.

In .NET 6 Release configuration builds, `$(AndroidPackageFormats)`
will default to `aab;apk`, i.e. both `.aab` and `.apk` files will be
produced by default.

In Legacy Xamarin.Android, `$(AndroidPackageFormats)` will not be
set, and `$(AndroidPackageFormat)` will continue to default to `.apk`,
meaning that only `.apk` files will be produced (this week…).

[0]: https://docs.microsoft.com/en-us/xamarin/android/deploy-test/building-apps/build-properties#androidpackageformat
[1]: https://developer.android.com/studio/command-line/bundletool
jonpryor pushed a commit that referenced this issue Aug 29, 2021
Fixes: #6059

Context: https://android-developers.googleblog.com/2020/11/new-android-app-bundle-and-target-api.html
Context: https://blogs.windows.com/windowsexperience/2021/06/24/building-a-new-open-microsoft-store-on-windows-11/
Context: https://developer.amazon.com/blogs/appstore/post/50b1ca0f-bbec-48ec-9eea-3c395efb8f9f/amazon-appstore-to-support-android-app-bundle

The Google Play Store requires Android App Bundles (`.aab` files) for
all new apps as of August 2021, and for all apps in November 2021.
Meanwhile, Microsoft has announced that Windows 11 will support
running Android apps and installing them via the Amazon Appstore,
which currently only supports `.apk` file uploads.

While a Xamarin.Android user could build their app twice, changing
the [`$(AndroidPackageFormat)`][0] between each build, we feel it
would be "better" -- faster, more convenient -- if a single
`SignAndroidPackage` target invocation could produce *both* `.aab`
and `.apk` outputs.

[`bundletool.jar`][1] has the ability to create a universal `.apk`
from the `.aab` file.

Introduce support for a new `$(AndroidPackageFormats)` (plural)
MSBuild property, which is a `;`-delimited sequence of
`$(AndroidPackageFormat)` values to produce as build outputs.
For example, if `$(AndroidPackageFormats)`=`aab;apk`, then *both*
`.aab` and `.apk` outputs will be produced.

	<PropertyGroup>
	  <AndroidPackageFormats>aab;apk</AndroidPackageFormats>
	</PropertyGroup>

The `.apk` output will be generated from the `.aab` file, ensuring
consistency.

In .NET 6 Debug configuration builds, `$(AndroidPackageFormats)` will
default to `.apk`, as this behaves better with Fast Deployment and
developer productivity.

In .NET 6 Release configuration builds, `$(AndroidPackageFormats)`
will default to `aab;apk`, i.e. both `.aab` and `.apk` files will be
produced by default.

In Legacy Xamarin.Android, `$(AndroidPackageFormats)` will not be
set, and `$(AndroidPackageFormat)` will continue to default to `.apk`,
meaning that only `.apk` files will be produced (this week…).

[0]: https://docs.microsoft.com/en-us/xamarin/android/deploy-test/building-apps/build-properties#androidpackageformat
[1]: https://developer.android.com/studio/command-line/bundletool
@ghost ghost locked as resolved and limited conversation to collaborators Jun 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: App+Library Build Issues when building Library projects or Application projects.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants