Skip to content

Commit

Permalink
[Xamarin.Android.Build.Tasks] Make manifestmerger.jar the default. (#…
Browse files Browse the repository at this point in the history
…8392)

Context: #8387

Context: 2c6f5cd
Context: f7ea4a3
Context: d794534

Update the value for `$(AndroidManifestMerger)` (f7ea4a3) to
`manifestmerger.jar`.  This allows users to make use of the new
features like `@(AndroidManifestOverlay)` (d794534) out of the box.

The old system is still available, users will need to add the
following to their csproj:

	<AndroidManifestMerger>legacy</AndroidManifestMerger>

AndroidX has been building with
`$(AndroidManifestMerger)`=manifestmerger.jar for
[over three years][0].

[0]: xamarin/AndroidX@c6c0e50
  • Loading branch information
dellis1972 authored Oct 9, 2023
1 parent 19d978b commit c6d5025
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
9 changes: 6 additions & 3 deletions Documentation/guides/building-apps/build-properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -987,9 +987,12 @@ merging *AndroidManifest.xml* files. This is an enum-style property
where `legacy` selects the original C# implementation
and `manifestmerger.jar` selects Google's Java implementation.

The default value is currently `legacy`. This will change to
`manifestmerger.jar` in a future release to align behavior with
Android Studio.
The default value is currently `manifestmerger.jar`. If you want to
use the old version add the following to your csproj

```xml
<AndroidManifestMerger>legacy</AndroidManifestMerger>
```

Google's merger enables support for `xmlns:tools="http://schemas.android.com/tools"`
as described in the [Android documentation][manifest-merger].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,8 @@ public void AllResourcesInClassLibrary ([Values (true, false)] bool useAapt2, [V
if (Builder.UseDotNet) {
lib.RemoveProperty ("OutputType");
}
lib.AndroidManifest = lib.AndroidManifest.
Replace ("application android:label=\"${PROJECT_NAME}\"", "application android:label=\"com.test.foo\" ");

// Create an "app" that is basically empty and references the library
var app = new XamarinAndroidLibraryProject {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,7 @@ public void MergeLibraryManifest ()
KnownPackages.SupportV7AppCompat_27_0_2_1,
},
};
proj.SetProperty ("AndroidManifestMerger", "legacy");
proj.Sources.Add (new BuildItem.Source ("TestActivity1.cs") {
TextContent = () => @"using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved.
<AndroidCreatePackagePerAbi Condition=" '$(AndroidCreatePackagePerAbi)' == 'aab' ">False</AndroidCreatePackagePerAbi>
<AndroidApkSigningAlgorithm Condition=" '$(AndroidApkSigningAlgorithm)' == '' ">SHA256withRSA</AndroidApkSigningAlgorithm>
<AndroidApkDigestAlgorithm Condition=" '$(AndroidApkDigestAlgorithm)' == '' ">SHA-256</AndroidApkDigestAlgorithm>
<AndroidManifestMerger Condition=" '$(AndroidManifestMerger)' == '' ">legacy</AndroidManifestMerger>
<AndroidManifestMerger Condition=" '$(AndroidManifestMerger)' == '' ">manifestmerger.jar</AndroidManifestMerger>

<!-- Default Java heap size to 1GB (-Xmx1G) if not specified-->
<JavaMaximumHeapSize Condition=" '$(JavaMaximumHeapSize)' == '' ">1G</JavaMaximumHeapSize>
Expand Down

0 comments on commit c6d5025

Please sign in to comment.