android: After update cannot build Android with error: Xamarin.Android.Common.targets (1392, 3): [XAGJS7009] System.InvalidOperationException: Duplicate attribute.

Build stack:

Xamarin.Android.Common.targets(1392, 3): [XAGJS7009] System.InvalidOperationException: Duplicate attribute. at System.Xml.Linq.XElement.AddAttributeSkipNotify (System.Xml.Linq.XAttribute a) [0x0000e] in <7a9b77c9c73b43f99a32b1ba98596ce4>:0 at System.Xml.Linq.XContainer.AddContentSkipNotify (System.Object content) [0x00032] in <7a9b77c9c73b43f99a32b1ba98596ce4>:0 at System.Xml.Linq.XContainer.Add (System.Object content) [0x00008] in <7a9b77c9c73b43f99a32b1ba98596ce4>:0 at Xamarin.Android.Tasks.ManifestDocument.AddLauncherIntentElements (System.Xml.Linq.XElement activity) [0x0004e] in <256050d9b61b4848876345a052636c75>:0 at Xamarin.Android.Tasks.ManifestDocument+<>c__DisplayClass99_0.<ActivityFromTypeDefinition>b__1 (Android.App.ActivityAttribute aa, System.Xml.Linq.XElement element) [0x00008] in <256050d9b61b4848876345a052636c75>:0 at Xamarin.Android.Tasks.ManifestDocument.ToElement[TAttribute] (Mono.Cecil.TypeDefinition type, System.String name, System.Func2[T,TResult] parser, System.Func2[T,TResult] toElement, System.Action2[T1,T2] update) [0x0007d] in <256050d9b61b4848876345a052636c75>:0 at Xamarin.Android.Tasks.ManifestDocument.ActivityFromTypeDefinition (Mono.Cecil.TypeDefinition type, System.String name, System.Int32 targetSdkVersion) [0x00043] in <256050d9b61b4848876345a052636c75>:0 at Xamarin.Android.Tasks.ManifestDocument.Merge (Microsoft.Build.Utilities.TaskLoggingHelper log, Java.Interop.Tools.Cecil.TypeDefinitionCache cache, System.Collections.Generic.List1[T] subclasses, System.String applicationClass, System.Boolean embed, System.String bundledWearApplicationName, System.Collections.Generic.IEnumerable`1[T] mergedManifestDocuments) [0x004c2] in <256050d9b61b4848876345a052636c75>:0 at Xamarin.Android.Tasks.GenerateJavaStubs.Run (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver res) [0x00766] in <256050d9b61b4848876345a052636c75>:0 at Xamarin.Android.Tasks.GenerateJavaStubs.RunTask () [0x0000e] in <256050d9b61b4848876345a052636c75>:0 at Microsoft.Android.Build.Tasks.AndroidTask.Execute () [0x00000] in <f24af698a51a478ab00657efe7dfcbde>:0

Version Information

=== Visual Studio Community 2019 for Mac ===

Version 8.10.12 (build 16) Installation UUID: a69fd0e8-a0ec-4b44-b769-73b2bbcb5b6d GTK+ 2.24.23 (Raleigh theme) Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

Package version: 612000140

=== Mono Framework MDK ===

Runtime: Mono 6.12.0.140 (2020-02/51d876a041e) (64-bit) Package version: 612000140

=== Roslyn (Language Service) ===

3.10.0-4.21269.26+029847714208ebe49668667c60ea5b0a294e0fcb

=== NuGet ===

Version: 5.9.0.7134

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/5.0.402/Sdks SDK Versions: 5.0.402 5.0.401 5.0.400 5.0.302 5.0.301 5.0.203 5.0.202 5.0.201 5.0.103 5.0.102 5.0.101 5.0.100 3.1.414 3.1.413 3.1.412 3.1.411 3.1.410 3.1.409 3.1.408 3.1.407 3.1.406 3.1.405 3.1.404 3.1.403 3.1.402 3.1.401 3.1.302 3.1.301 3.1.300 3.1.202 3.1.200 3.1.102 3.1.101 3.1.100 3.0.101 3.0.100 2.1.701 2.1.700 2.1.505 2.1.504 2.1.503 2.1.302 2.1.301 2.1.4 MSBuild SDKs: /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet Runtime Versions: 5.0.11 5.0.10 5.0.9 5.0.8 5.0.7 5.0.6 5.0.5 5.0.4 5.0.3 5.0.2 5.0.1 5.0.0 3.1.20 3.1.19 3.1.18 3.1.17 3.1.16 3.1.15 3.1.14 3.1.13 3.1.12 3.1.11 3.1.10 3.1.9 3.1.8 3.1.7 3.1.6 3.1.5 3.1.4 3.1.2 3.1.1 3.1.0 3.0.1 3.0.0 2.1.23 2.1.22 2.1.21 2.1.20 2.1.19 2.1.18 2.1.17 2.1.16 2.1.15 2.1.14 2.1.13 2.1.12 2.1.11 2.1.9 2.1.8 2.1.7 2.1.2 2.1.1 2.0.5

=== .NET Core 3.1 SDK ===

SDK: 3.1.414

=== Xamarin.Profiler ===

‘/Applications/Xamarin Profiler.app’ not found

=== Updater ===

Version: 11

=== Xamarin Designer ===

Version: 16.11.0.39 Hash: cd672761d Branch: remotes/origin/d16-11 Build date: 2021-10-06 20:09:18 UTC

=== Apple Developer Tools ===

Xcode 13.0 (19234) Build 13A233

=== Xamarin.Mac ===

Version: 8.2.0.1 (Visual Studio Community) Hash: 8fd9e6289 Branch: xcode13.1 Build date: 2021-10-26 10:13:55-0400

=== Xamarin.iOS ===

Version: 15.2.0.1 (Visual Studio Community) Hash: 8fd9e6289 Branch: xcode13.1 Build date: 2021-10-26 10:13:56-0400

=== Xamarin.Android ===

Version: 12.0.0.3 (Visual Studio Community) Commit: xamarin-android/d16-11/f0e3c2d Android SDK: /Users/matteo/Library/Developer/Xamarin/android-sdk-macosx Supported Android versions: 7.1 (API level 25) 8.1 (API level 27)

SDK Tools Version: 26.1.1 SDK Platform Tools Version: 30.0.5 SDK Build Tools Version: 30.0.2

Build Information: Mono: c633fe9 Java.Interop: xamarin/java.interop/d16-11@476bb5b ProGuard: Guardsquare/proguard/v7.0.1@912d149 SQLite: xamarin/sqlite/3.35.4@85460d3 Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-11@87af37b

=== Eclipse Temurin JDK ===

Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home 1.8.0_302 Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 16.10.0.13 Hash: 1b81df5 Branch: remotes/origin/d16-10 Build date: 2021-09-28 20:47:12 UTC

=== Android Device Manager ===

Version: 16.10.0.15 Hash: 89dcc0b Branch: remotes/origin/d16-10 Build date: 2021-09-28 20:47:30 UTC

=== Build Information ===

Release ID: 810120016 Git revision: e4f3f43ac50d8e0f83a71dbcb666bb1611a661d7 Build date: 2021-10-28 12:10:44-04 Build branch: release-8.10

=== Operating System ===

Mac OS X 10.16.0 Darwin 20.6.0 Darwin Kernel Version 20.6.0 Wed Jun 23 00:26:31 PDT 2021 root:xnu-7195.141.2~5/RELEASE_X86_64 x86_64

=== Enabled user installed extensions ===

NuGet Package Management Extensions 0.27

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 7
  • Comments: 29 (5 by maintainers)

Commits related to this issue

Most upvoted comments

for me only removing Exported = true from the splash screen works too

This is fixed in https://github.com/xamarin/xamarin-android/commit/9f2d3bfa4fe65eeb254ebc2382e862ba0e8c43b4. It should be going out in the next Xamarin.Android release.

The workaround is to remove Exported = true on any [Activity] attributes. Hope that helps, thanks!

This is also an issue on Azure Pipelines, windows-2019 agent. However, windows-2022 agent does not have it.

It sounds good! I will try with your solution and let you know. Thanks for your updates!

On Sat, Apr 2, 2022 at 12:15 AM venkatsunilm @.***> wrote:

I have VS 2022 in Windows machine. V17.1.3 I have updated Androidx and XF etc to the latest available PFB the complete details. Hi, I have used Exported = true in SplashActivity and in AndroidManifest in activity attribute as mentioned above. The problem is resolved when i delete the bin and obj folder but when i compile again i cannot install in the devices which is running above API 30 but no issues below that. It’s like if I delete bin, obj and restart VS then it installs.

Any help appreciated. 😃

Microsoft Visual Studio Enterprise 2022 Version 17.1.3 VisualStudio.17.Release/17.1.3+32328.378 Microsoft .NET Framework Version 4.8.04084

Installed Version: Enterprise

Azure App Service Tools v3.0.0 17.1.358.51495 Azure App Service Tools v3.0.0

C# Tools 4.1.0-5.22165.10+e555772db77ca828b02b4bd547c318387f11d01f C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus 1.2.6 @.***) Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger 1.0 Provides support for connecting Visual Studio to MI compatible debuggers

Mono Debugging for Visual Studio 17.1.10 (65f98f5) Support for debugging Mono processes with Visual Studio.

NuGet Package Manager 6.1.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Visual Basic Tools 4.1.0-5.22165.10+e555772db77ca828b02b4bd547c318387f11d01f Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 17.1.0-beta.21610.4+07b5673e4f2fa7630e78abe37f16b372353a7242 Microsoft Visual F# Tools

Visual Studio Code Debug Adapter Host Package 1.0 Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio IntelliCode 2.2 AI-assisted development for Visual Studio.

VisualStudio.DeviceLog 1.0 Information about my package

VisualStudio.Foo 1.0 Information about my package

VisualStudio.Mac 1.0 Mac Extension for Visual Studio

Xamarin 17.1.0.324 @.***) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 17.1.0.87 @.***) Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 17.1.8 (590388a) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 12.2.0.4 (d17-1/19b97b7) Xamarin.Android Reference Assemblies and MSBuild support. Mono: a5d1934 Java.Interop: @.*** https://github.com/xamarin/java.interop/commit/7ac33610 ProGuard: @.*** https://github.com/Guardsquare/proguard/commit/912d149 SQLite: @.*** https://github.com/xamarin/sqlite/commit/0893b3b Xamarin.Android Tools: @.*** https://github.com/xamarin/xamarin-android-tools/commit/db125a7

Xamarin.iOS and Xamarin.Mac SDK 15.8.0.2 (79ddd0840) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

— Reply to this email directly, view it on GitHub https://github.com/xamarin/xamarin-android/issues/6463#issuecomment-1086103328, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANN5YMLM4V74UJD26PPWYYDVC4OKHANCNFSM5HJH77FA . You are receiving this because you were mentioned.Message ID: @.***>