diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidUpdateResourcesTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidUpdateResourcesTest.cs
index 23599a2bc79..35037b064b9 100644
--- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidUpdateResourcesTest.cs
+++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidUpdateResourcesTest.cs
@@ -1372,5 +1372,42 @@ public void LightlyModifyLayout ()
Assert.IsFalse (b.Output.IsTargetSkipped ("_UpdateAndroidResgen"), "`_UpdateAndroidResgen` should not be skipped!");
}
}
+
+ [Test]
+ public void CustomViewAddResourceId ([Values (false, true)] bool useAapt2)
+ {
+ var proj = new XamarinAndroidApplicationProject ();
+ proj.SetProperty ("AndroidUseAapt2", useAapt2.ToString ());
+ proj.LayoutMain = proj.LayoutMain.Replace ("", "");
+ proj.Packages.Add (KnownPackages.Android_Arch_Core_Common_26_1_0);
+ proj.Packages.Add (KnownPackages.Android_Arch_Lifecycle_Common_26_1_0);
+ proj.Packages.Add (KnownPackages.Android_Arch_Lifecycle_Runtime_26_1_0);
+ proj.Packages.Add (KnownPackages.AndroidSupportV4_27_0_2_1);
+ proj.Packages.Add (KnownPackages.SupportCompat_27_0_2_1);
+ proj.Packages.Add (KnownPackages.SupportCoreUI_27_0_2_1);
+ proj.Packages.Add (KnownPackages.SupportCoreUtils_27_0_2_1);
+ proj.Packages.Add (KnownPackages.SupportDesign_27_0_2_1);
+ proj.Packages.Add (KnownPackages.SupportFragment_27_0_2_1);
+ proj.Packages.Add (KnownPackages.SupportMediaCompat_27_0_2_1);
+ proj.Packages.Add (KnownPackages.SupportV7AppCompat_27_0_2_1);
+ proj.Packages.Add (KnownPackages.SupportV7CardView_27_0_2_1);
+ proj.Packages.Add (KnownPackages.SupportV7MediaRouter_27_0_2_1);
+ proj.Packages.Add (KnownPackages.SupportV7RecyclerView_27_0_2_1);
+ using (var b = CreateApkBuilder (Path.Combine ("temp", TestName))) {
+ Assert.IsTrue (b.Build (proj), "first build should have succeeded");
+
+ //Add a new android:id
+ var textView1 = "textView1";
+ proj.LayoutMain = proj.LayoutMain.Replace ("", $"");
+ proj.Touch (@"Resources\layout\Main.axml");
+
+ Assert.IsTrue (b.Build (proj, doNotCleanupOnUpdate: true), "second build should have succeeded");
+
+ var r_java = Path.Combine (Root, b.ProjectDirectory, proj.IntermediateOutputPath, "android", "src", "android", "support", "compat", "R.java");
+ FileAssert.Exists (r_java);
+ var r_java_contents = File.ReadAllLines (r_java);
+ Assert.IsTrue (StringAssertEx.ContainsText (r_java_contents, textView1), $"android/support/compat/R.java should contain `{textView1}`!");
+ }
+ }
}
}
diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets
index 31b5ec62ffb..5d9733697c9 100755
--- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets
+++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets
@@ -1526,7 +1526,7 @@ because xbuild doesn't support framework reference assemblies.
@@ -1545,7 +1545,6 @@ because xbuild doesn't support framework reference assemblies.
ResourceDirectory="$(MonoAndroidResDirIntermediate)"
AdditionalResourceDirectories="@(LibraryResourceDirectories)"
AdditionalAndroidResourcePaths="@(_AdditonalAndroidResourceCachePaths)"
- AndroidComponentResgenFlagFile="$(_AndroidComponentResgenFlagFile)"
ToolPath="$(AaptToolPath)"
ToolExe="$(AaptToolExe)"
ApiLevel="$(_AndroidTargetSdkVersion)"