Skip to content

Commit c6d5025

Browse files
authored
[Xamarin.Android.Build.Tasks] Make manifestmerger.jar the default. (#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]: dotnet/android-libraries@c6c0e50
1 parent 19d978b commit c6d5025

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

Documentation/guides/building-apps/build-properties.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -987,9 +987,12 @@ merging *AndroidManifest.xml* files. This is an enum-style property
987987
where `legacy` selects the original C# implementation
988988
and `manifestmerger.jar` selects Google's Java implementation.
989989

990-
The default value is currently `legacy`. This will change to
991-
`manifestmerger.jar` in a future release to align behavior with
992-
Android Studio.
990+
The default value is currently `manifestmerger.jar`. If you want to
991+
use the old version add the following to your csproj
992+
993+
```xml
994+
<AndroidManifestMerger>legacy</AndroidManifestMerger>
995+
```
993996

994997
Google's merger enables support for `xmlns:tools="http://schemas.android.com/tools"`
995998
as described in the [Android documentation][manifest-merger].

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildWithLibraryTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,8 @@ public void AllResourcesInClassLibrary ([Values (true, false)] bool useAapt2, [V
670670
if (Builder.UseDotNet) {
671671
lib.RemoveProperty ("OutputType");
672672
}
673+
lib.AndroidManifest = lib.AndroidManifest.
674+
Replace ("application android:label=\"${PROJECT_NAME}\"", "application android:label=\"com.test.foo\" ");
673675

674676
// Create an "app" that is basically empty and references the library
675677
var app = new XamarinAndroidLibraryProject {

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/ManifestTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,7 @@ public void MergeLibraryManifest ()
755755
KnownPackages.SupportV7AppCompat_27_0_2_1,
756756
},
757757
};
758+
proj.SetProperty ("AndroidManifestMerger", "legacy");
758759
proj.Sources.Add (new BuildItem.Source ("TestActivity1.cs") {
759760
TextContent = () => @"using System;
760761
using System.Collections.Generic;

src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved.
275275
<AndroidCreatePackagePerAbi Condition=" '$(AndroidCreatePackagePerAbi)' == 'aab' ">False</AndroidCreatePackagePerAbi>
276276
<AndroidApkSigningAlgorithm Condition=" '$(AndroidApkSigningAlgorithm)' == '' ">SHA256withRSA</AndroidApkSigningAlgorithm>
277277
<AndroidApkDigestAlgorithm Condition=" '$(AndroidApkDigestAlgorithm)' == '' ">SHA-256</AndroidApkDigestAlgorithm>
278-
<AndroidManifestMerger Condition=" '$(AndroidManifestMerger)' == '' ">legacy</AndroidManifestMerger>
278+
<AndroidManifestMerger Condition=" '$(AndroidManifestMerger)' == '' ">manifestmerger.jar</AndroidManifestMerger>
279279

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

0 commit comments

Comments
 (0)