-
Notifications
You must be signed in to change notification settings - Fork 555
[Xamarin.Android.Build.Tasks] Add Support for bundletool meta-data #6616
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
Conversation
tests/apk-sizes-reference/Xamarin.Forms_Performance_Integration-Signed-Release-Bundle.apkdesc
Outdated
Show resolved
Hide resolved
ca852d8
to
84e8c59
Compare
Shouldn't we enable this by default for .NET 6+ apps? |
Enabling this causes the apk to get bigger (which is why the apkdiff desc files were updated in the first place). Is this something we want? |
0137410
to
66cabca
Compare
66cabca
to
e148a97
Compare
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
5547825
to
1e9bc83
Compare
The |
Context: https://discord.com/channels/732297728826277939/732297837953679412/933674595557466172 Enabling @dellis1972: That said, where is that 1% coming from? I figured there'd be a |
Fixes: https://github.com/xamarin/xamarin-android/issues/5378
Context: 2dab2bc3725a3ca3d56c6767c60f0eecf6426f46
When uploading an `.apk` or `.aab` file which contains native
libraries such as AOT'd .NET assemblies to the Google Play store,
the Google Play Console reports the following warning:
> This App Bundle contains native code, and you've not uploaded
> debug symbols. We recommend that you upload a symbol file to make
> your crashes and ANRs easier to analyse and debug.
Commit 2dab2bc3 addresses a similar warning regarding obfuscated
Java/Kotlin code.
Improve support for this scenario by adding a new
`$(AndroidCreateProguardMappingFile)` MSBuild property which controls
the creation of the ProGuard mapping file.
When True (the default when r8 is used), a ProGuard mapping file will
be created and added to `.apk`/`.aab` build outputs. This increases
the size of resulting applications by ~1% for our unit tests, and
will remove the above warning for Google Play Store submissions.
To make `$(AndroidCreateProguardMappingFile)`=True *work*, add
support for a new `@(AndroidAppBundleMetaDataFile)` item group.
`%(AndroidAppBundleMetaDataFile.Include)` values are those used by
the [`bundletool build-bundle --metadata-file`][0] option:
> `--metadata-file=target-bundle-path:local-file-path`
>
> * `target-bundle-path` specifies a path relative to the root of
> the app bundle where you would like the metadata file to be
> packaged, and
> * `local-file-path` specifies the path to the local metadata file
> itself.
When `$(AndroidCreateProguardMappingFile)`=True, we automatically add:
<AndroidAppBundleMetaDataFile Include="com.android.tools.build.obfuscation/proguard.map:$(AndroidProguardMappingFile" />
which causes the ProGuard mapping file to be included into the bundle.
[0]: https://developer.android.com/studio/build/building-cmdline#bundletool-build |
Fixes: dotnet#5378 Context: 2dab2bc When uploading an `.apk` or `.aab` file which contains native libraries such as AOT'd .NET assemblies to the Google Play store, the Google Play Console reports the following warning: > This App Bundle contains native code, and you've not uploaded > debug symbols. We recommend that you upload a symbol file to make > your crashes and ANRs easier to analyse and debug. Commit 2dab2bc addresses a similar warning regarding obfuscated Java/Kotlin code. Improve support for this scenario by adding a new `$(AndroidCreateProguardMappingFile)` MSBuild property which controls the creation of the ProGuard mapping file. When True (the default when r8 is used), a ProGuard mapping file will be created and added to `.apk`/`.aab` build outputs. This increases the size of resulting applications by ~1% for our unit tests, and will remove the above warning for Google Play Store submissions. To make `$(AndroidCreateProguardMappingFile)`=True *work*, add support for a new `@(AndroidAppBundleMetaDataFile)` item group. `%(AndroidAppBundleMetaDataFile.Include)` values are those used by the [`bundletool build-bundle --metadata-file`][0] option: > `--metadata-file=target-bundle-path:local-file-path` > > * `target-bundle-path` specifies a path relative to the root of > the app bundle where you would like the metadata file to be > packaged, and > * `local-file-path` specifies the path to the local metadata file > itself. When `$(AndroidCreateProguardMappingFile)`=True, we automatically add: <AndroidAppBundleMetaDataFile Include="com.android.tools.build.obfuscation/proguard.map:$(AndroidProguardMappingFile" /> which causes the ProGuard mapping file to be included into the bundle. This only applies to `.aab` package formats. For `.apk` files the ProGuard mapping file will not be included in the `.apk`, as it doesn't not support it. However the file will be copied to the `$(OutputPath)` along with the `.apk`. It can be manually uploaded to the Google Play Store from there. [0]: https://developer.android.com/studio/build/building-cmdline#bundletool-build
51e1a3f
to
d5cb94c
Compare
@jonpryor I made a few additions to your commit message and updated my commit to use it. |
Test failure seems unrelated |
Fixes: #5378
Context: 2dab2bc
When uploading an
.apk
or.aab
file which contains nativelibraries such as AOT'd .NET assemblies to the Google Play store,
the Google Play Console reports the following warning:
Commit 2dab2bc addresses a similar warning regarding obfuscated
Java/Kotlin code.
Improve support for this scenario by adding a new
$(AndroidCreateProguardMappingFile)
MSBuild property which controlsthe creation of the ProGuard mapping file.
When True (the default when r8 is used), a ProGuard mapping file will
be created and added to
.apk
/.aab
build outputs. This increasesthe size of resulting applications by ~1% for our unit tests, and
will remove the above warning for Google Play Store submissions.
To make
$(AndroidCreateProguardMappingFile)
=True work, addsupport for a new
@(AndroidAppBundleMetaDataFile)
item group.%(AndroidAppBundleMetaDataFile.Include)
values are those used bythe
bundletool build-bundle --metadata-file
option:When
$(AndroidCreateProguardMappingFile)
=True, we automatically add:which causes the ProGuard mapping file to be included into the bundle.
This only applies to
.aab
package formats.For
.apk
files the ProGuard mapping file will not be included in the.apk
, as it doesn't not support it. However the file will be copiedto the
$(OutputPath)
along with the.apk
. It can be manually uploadedto the Google Play Store from there.