From 389ac6ee8aafe10e73aaadb69a0bd41e49a2d5e9 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Mon, 10 Oct 2022 10:36:02 +0100 Subject: [PATCH 1/6] [Xamarin.Android.Build.Tasks] Add XA1031 error for `AndroidHttpClientHandlerType` Fixes #7326 We should check the value of the `AndroidHttpClientHandlerType` property during the build process. This property can have a number of different values depending on what version of Xamarin.Android is being used. Under Classic a valid value is `Xamarin.Android.Net.AndroidClientHandler`, however under .NET 6+ the valid values are - `Xamarin.Android.Net.AndroidMessageHandler`. - `System.Net.Http.SocketsHttpHandler, System.Net.Http`. We should raise an error if the user is using an invalid value. --- Documentation/guides/messages/README.md | 3 + Documentation/guides/messages/xa1031.md | 20 + Documentation/guides/messages/xa1032.md | 19 + Documentation/guides/messages/xa1033.md | 19 + .../Microsoft.Android.Sdk.BuildOrder.targets | 1 + ...soft.Android.Sdk.DefaultProperties.targets | 1 + .../Properties/Resources.Designer.cs | 347 ++++++++++-------- .../Properties/Resources.resx | 18 + .../Tasks/CheckClientHandlerType.cs | 95 +++++ .../EnvironmentContentTests.cs | 21 ++ .../Tasks/CheckClientHandlerTypeTests.cs | 91 +++++ .../Tasks/LinkerTests.cs | 16 +- .../Xamarin.ProjectTools/Common/Builder.cs | 2 +- .../Common/ProjectBuilder.cs | 1 - .../Xamarin.Android.Common.targets | 15 + .../Xamarin.Android.Legacy.targets | 1 + 16 files changed, 503 insertions(+), 167 deletions(-) create mode 100644 Documentation/guides/messages/xa1031.md create mode 100644 Documentation/guides/messages/xa1032.md create mode 100644 Documentation/guides/messages/xa1033.md create mode 100644 src/Xamarin.Android.Build.Tasks/Tasks/CheckClientHandlerType.cs create mode 100644 src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/CheckClientHandlerTypeTests.cs diff --git a/Documentation/guides/messages/README.md b/Documentation/guides/messages/README.md index 65c162779fe..c31c84e89dc 100644 --- a/Documentation/guides/messages/README.md +++ b/Documentation/guides/messages/README.md @@ -130,6 +130,9 @@ or 'Help->Report a Problem' in Visual Studio for Mac. + [XA1027](xa1027.md): The 'EnableProguard' MSBuild property is set to 'true' and the 'AndroidLinkTool' MSBuild property is empty, so 'AndroidLinkTool' will default to 'proguard'. + [XA1028](xa1028.md): The 'AndroidEnableProguard' MSBuild property is set to 'true' and the 'AndroidLinkTool' MSBuild property is empty, so 'AndroidLinkTool' will default to 'proguard'. + [XA1029](xa1029.md): The 'AotAssemblies' MSBuild property is deprecated. Edit the project file in a text editor to remove this property, and use the 'RunAOTCompilation' MSBuild property instead. ++ [XA1031](xa1031.md): The 'AndroidHttpClientHandlerType' has an invalid value. ++ [XA1032](xa1032.md):Failed to resolve '{0}' from '{1}'. Please check your `AndroidHttpClientHandlerType` setting. ++ [XA1033](xa1033.md): Could not resolve '{0}'. Please check your `AndroidHttpClientHandlerType` setting. ## XA2xxx: Linker diff --git a/Documentation/guides/messages/xa1031.md b/Documentation/guides/messages/xa1031.md new file mode 100644 index 00000000000..401a5b3c6d1 --- /dev/null +++ b/Documentation/guides/messages/xa1031.md @@ -0,0 +1,20 @@ +--- +title: Xamarin.Android error XA1031 +description: XA1031 error code +ms.date: 10/10/2022 +--- +# Xamarin.Android error XA1031 + +## Example messages + +``` +The 'AndroidHttpClientHandlerType' property value 'Foo.Bar.HttpHander, MyApp' must derive from 'System.Net.Http.HttpMessageHandler'. +Please change the value to an assembly-qualifed type name which inherits from '{1}' or remove the property completely. +``` + +## Solution + +Edit your csproj directly and change the 'AndroidHttpClientHandlerType' to +a valid value. + +Valid values can be found at `~/android/deploy-test/building-apps/build-properties.md#AndroidHttpClientHandlerType`. \ No newline at end of file diff --git a/Documentation/guides/messages/xa1032.md b/Documentation/guides/messages/xa1032.md new file mode 100644 index 00000000000..24d058bc17b --- /dev/null +++ b/Documentation/guides/messages/xa1032.md @@ -0,0 +1,19 @@ +--- +title: Xamarin.Android error XA1032 +description: XA1032 error code +ms.date: 10/10/2022 +--- +# Xamarin.Android error XA1032 + +## Example messages + +``` +Failed to resolve '{0}' from '{1}'. Please check your `AndroidHttpClientHandlerType` setting. +``` + +## Solution + +Edit your csproj directly and change the 'AndroidHttpClientHandlerType' to +a valid value. + +Valid values can be found at `~/android/deploy-test/building-apps/build-properties.md#AndroidHttpClientHandlerType`. \ No newline at end of file diff --git a/Documentation/guides/messages/xa1033.md b/Documentation/guides/messages/xa1033.md new file mode 100644 index 00000000000..f1d68bc0d84 --- /dev/null +++ b/Documentation/guides/messages/xa1033.md @@ -0,0 +1,19 @@ +--- +title: Xamarin.Android error XA1033 +description: XA1033 error code +ms.date: 10/10/2022 +--- +# Xamarin.Android error XA1033 + +## Example messages + +``` +Could not resolve '{0}'. Please check your `AndroidHttpClientHandlerType` setting. +``` + +## Solution + +Edit your csproj directly and change the 'AndroidHttpClientHandlerType' to +a valid value. + +Valid values can be found at `~/android/deploy-test/building-apps/build-properties.md#AndroidHttpClientHandlerType`. \ No newline at end of file diff --git a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.BuildOrder.targets b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.BuildOrder.targets index 89ba48fabd0..7502dad455e 100644 --- a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.BuildOrder.targets +++ b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.BuildOrder.targets @@ -28,6 +28,7 @@ projects, these properties are set in Xamarin.Android.Legacy.targets. _CollectJavaSourceForBinding; _CompileBindingJava; $(BuildDependsOn); + _CheckAndroidHttpClientHandlerType; _CompileDex; $(_AfterCompileDex); diff --git a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets index 2d83fb1ef7d..687dc79e266 100644 --- a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets +++ b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets @@ -95,6 +95,7 @@ false false false + false true <_AggressiveAttributeTrimming Condition="'$(_AggressiveAttributeTrimming)' == ''">true false diff --git a/src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs b/src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs index 3986942c563..b2a969da7cc 100644 --- a/src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs +++ b/src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs @@ -10,8 +10,8 @@ namespace Xamarin.Android.Tasks.Properties { using System; - - + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -23,15 +23,15 @@ namespace Xamarin.Android.Tasks.Properties { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class Resources { - + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } - + /// /// Returns the cached ResourceManager instance used by this class. /// @@ -45,7 +45,7 @@ internal Resources() { return resourceMan; } } - + /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. @@ -59,7 +59,7 @@ internal Resources() { resourceCulture = value; } } - + /// /// Looks up a localized string similar to {0}. /// @@ -70,7 +70,7 @@ public static string AAPTManifestError { return ResourceManager.GetString("AAPTManifestError", resourceCulture); } } - + /// /// Looks up a localized string similar to Unknown option `{0}`. Please check `$(AndroidAapt2CompileExtraArgs)` and `$(AndroidAapt2LinkExtraArgs)` to see if they include any `aapt` command line arguments that are no longer valid for `aapt2` and ensure that all other arguments are valid for `aapt2`.. /// @@ -79,7 +79,7 @@ public static string APT0001 { return ResourceManager.GetString("APT0001", resourceCulture); } } - + /// /// Looks up a localized string similar to Invalid file name: It must contain only {0}.. /// @@ -88,7 +88,7 @@ public static string APT0002 { return ResourceManager.GetString("APT0002", resourceCulture); } } - + /// /// Looks up a localized string similar to Invalid file name: It must contain only {0}.. /// @@ -97,7 +97,7 @@ public static string APT0003 { return ResourceManager.GetString("APT0003", resourceCulture); } } - + /// /// Looks up a localized string similar to Invalid file name: It must start with A-z or a-z or an underscore.. /// @@ -106,7 +106,7 @@ public static string APT0004 { return ResourceManager.GetString("APT0004", resourceCulture); } } - + /// /// Looks up a localized string similar to Directory '{0}' is from '{1}'.. /// @@ -115,9 +115,9 @@ public static string XA_Directory_Is_From { return ResourceManager.GetString("XA_Directory_Is_From", resourceCulture); } } - + /// - /// Looks up a localized string similar to + /// Looks up a localized string similar to /// This code was generated by a tool. /// It was generated from {0} /// Changes to this file may cause incorrect behavior and will be lost if @@ -129,7 +129,7 @@ public static string XA_Manifest_AutoGenerated_Header { return ResourceManager.GetString("XA_Manifest_AutoGenerated_Header", resourceCulture); } } - + /// /// Looks up a localized string similar to Could not determine API level for $(TargetFrameworkVersion) of '{0}'.. /// @@ -138,7 +138,7 @@ public static string XA0000_API_for_TargetFrameworkVersion { return ResourceManager.GetString("XA0000_API_for_TargetFrameworkVersion", resourceCulture); } } - + /// /// Looks up a localized string similar to Could not determine $(AndroidApiLevel) or $(TargetFrameworkVersion); should not be reached.. /// @@ -147,7 +147,7 @@ public static string XA0000_API_or_TargetFrameworkVersion_Fail { return ResourceManager.GetString("XA0000_API_or_TargetFrameworkVersion_Fail", resourceCulture); } } - + /// /// Looks up a localized string similar to Unhandled exception: {0}. /// @@ -156,7 +156,7 @@ public static string XA0000_Exception { return ResourceManager.GetString("XA0000_Exception", resourceCulture); } } - + /// /// Looks up a localized string similar to Could not determine $(TargetFrameworkVersion) for API level '{0}.'. /// @@ -165,7 +165,7 @@ public static string XA0000_TargetFrameworkVersion_for_API { return ResourceManager.GetString("XA0000_TargetFrameworkVersion_for_API", resourceCulture); } } - + /// /// Looks up a localized string similar to Unsupported or invalid $(TargetFrameworkVersion) value of '{0}'. Please update your Project Options.. /// @@ -174,7 +174,7 @@ public static string XA0001 { return ResourceManager.GetString("XA0001", resourceCulture); } } - + /// /// Looks up a localized string similar to Could not find mono.android.jar. /// @@ -183,7 +183,7 @@ public static string XA0002 { return ResourceManager.GetString("XA0002", resourceCulture); } } - + /// /// Looks up a localized string similar to Invalid `android:versionCode` value `{0}` in `AndroidManifest.xml`. It must be an integer value.. /// @@ -192,7 +192,7 @@ public static string XA0003 { return ResourceManager.GetString("XA0003", resourceCulture); } } - + /// /// Looks up a localized string similar to Invalid `android:versionCode` value `{0}` in `AndroidManifest.xml`. The value must be in the range of 0 to {1}.. /// @@ -201,7 +201,7 @@ public static string XA0004 { return ResourceManager.GetString("XA0004", resourceCulture); } } - + /// /// Looks up a localized string similar to Building with JDK version `{0}` is not supported. Please install JDK version `{1}`. See https://aka.ms/xamarin/jdk9-errors. /// @@ -210,7 +210,7 @@ public static string XA0030 { return ResourceManager.GetString("XA0030", resourceCulture); } } - + /// /// Looks up a localized string similar to Java SDK {0} or above is required when using {1}. ///Download the latest JDK at: https://aka.ms/msopenjdk @@ -221,7 +221,7 @@ public static string XA0031 { return ResourceManager.GetString("XA0031", resourceCulture); } } - + /// /// Looks up a localized string similar to Java SDK {0} or above is required when using .NET 6 or higher. Download the latest JDK at: https://aka.ms/msopenjdk. /// @@ -230,7 +230,7 @@ public static string XA0031_NET { return ResourceManager.GetString("XA0031_NET", resourceCulture); } } - + /// /// Looks up a localized string similar to Java SDK {0} or above is required when using Android SDK Build-Tools {1}.. /// @@ -239,7 +239,7 @@ public static string XA0032 { return ResourceManager.GetString("XA0032", resourceCulture); } } - + /// /// Looks up a localized string similar to Failed to get the Java SDK version because the returned value does not appear to contain a valid version number. `{0} -version` returned: ```{1}```. /// @@ -248,7 +248,7 @@ public static string XA0033 { return ResourceManager.GetString("XA0033", resourceCulture); } } - + /// /// Looks up a localized string similar to Failed to get the Java SDK version. Please ensure you have Java {0} or above installed.. /// @@ -257,7 +257,7 @@ public static string XA0034 { return ResourceManager.GetString("XA0034", resourceCulture); } } - + /// /// Looks up a localized string similar to Unable to determine the Android ABI from the value '{0}'. Edit the project file in a text editor and set the 'RuntimeIdentifiers' MSBuild property to contain only valid identifiers for the Android platform.. /// @@ -266,7 +266,7 @@ public static string XA0035 { return ResourceManager.GetString("XA0035", resourceCulture); } } - + /// /// Looks up a localized string similar to The 'AndroidSupportedAbis' MSBuild property is no longer supported. Edit the project file in a text editor, remove any uses of 'AndroidSupportedAbis', and use the 'RuntimeIdentifiers' MSBuild property instead.. /// @@ -275,7 +275,7 @@ public static string XA0036 { return ResourceManager.GetString("XA0036", resourceCulture); } } - + /// /// Looks up a localized string similar to EmbeddedNativeLibrary '{0}' is invalid in Android Application projects. Please use AndroidNativeLibrary instead.. /// @@ -284,7 +284,7 @@ public static string XA0100 { return ResourceManager.GetString("XA0100", resourceCulture); } } - + /// /// Looks up a localized string similar to Invalid value for `$(AndroidSequencePointsMode)`: {0}. /// @@ -293,7 +293,7 @@ public static string XA0104 { return ResourceManager.GetString("XA0104", resourceCulture); } } - + /// /// Looks up a localized string similar to The $(TargetFrameworkVersion) for {0} ({1}) is greater than the $(TargetFrameworkVersion) for the application project ({2}). Please increase the $(TargetFrameworkVersion) for the application project.. /// @@ -302,7 +302,7 @@ public static string XA0105 { return ResourceManager.GetString("XA0105", resourceCulture); } } - + /// /// Looks up a localized string similar to {0} is a Reference Assembly.. /// @@ -311,7 +311,7 @@ public static string XA0107 { return ResourceManager.GetString("XA0107", resourceCulture); } } - + /// /// Looks up a localized string similar to Ignoring Reference Assembly `{0}`.. /// @@ -320,7 +320,7 @@ public static string XA0107_Ignoring { return ResourceManager.GetString("XA0107_Ignoring", resourceCulture); } } - + /// /// Looks up a localized string similar to Could not get version from '{0}'. Defaulting to 1.0. /// @@ -329,7 +329,7 @@ public static string XA0108 { return ResourceManager.GetString("XA0108", resourceCulture); } } - + /// /// Looks up a localized string similar to Unsupported version of AAPT2 found at path '{0}'. Open the project file in a text editor and remove the 'Aapt2ToolPath' MSBuild property or ensure it is set to a valid location.. /// @@ -338,7 +338,7 @@ public static string XA0111 { return ResourceManager.GetString("XA0111", resourceCulture); } } - + /// /// Looks up a localized string similar to AAPT2 was not found at path '{0}'. Open the project file in a text editor and remove the 'Aapt2ToolPath' MSBuild property or ensure it is set to a valid location.. /// @@ -347,7 +347,7 @@ public static string XA0112 { return ResourceManager.GetString("XA0112", resourceCulture); } } - + /// /// Looks up a localized string similar to Google Play requires that new applications and updates must use a TargetFrameworkVersion of {0} (API level {1}) or above. You are currently targeting {2} (API level {3}).. /// @@ -356,7 +356,7 @@ public static string XA0113 { return ResourceManager.GetString("XA0113", resourceCulture); } } - + /// /// Looks up a localized string similar to Unable to find `EmbeddedResource` named `{0}`.. /// @@ -365,7 +365,7 @@ public static string XA0116 { return ResourceManager.GetString("XA0116", resourceCulture); } } - + /// /// Looks up a localized string similar to The TargetFrameworkVersion {0} is deprecated. Please update it to be v5.0 or higher.. /// @@ -374,7 +374,7 @@ public static string XA0117 { return ResourceManager.GetString("XA0117", resourceCulture); } } - + /// /// Looks up a localized string similar to Could not parse '{0}'. /// @@ -383,7 +383,7 @@ public static string XA0118_Parse { return ResourceManager.GetString("XA0118_Parse", resourceCulture); } } - + /// /// Looks up a localized string similar to Could not resolve `target` in lock file for '{0}'. /// @@ -392,7 +392,7 @@ public static string XA0118_Target { return ResourceManager.GetString("XA0118_Target", resourceCulture); } } - + /// /// Looks up a localized string similar to Using Fast Deployment and Android App Bundles at the same time is not currently supported. Use Fast Deployment for Debug configurations and Android App Bundles for Release configurations.. /// @@ -401,7 +401,7 @@ public static string XA0119_AAB { return ResourceManager.GetString("XA0119_AAB", resourceCulture); } } - + /// /// Looks up a localized string similar to Using fast deployment and AOT at the same time is not recommended. Use fast deployment for Debug configurations and AOT for Release configurations.. /// @@ -410,7 +410,7 @@ public static string XA0119_AOT { return ResourceManager.GetString("XA0119_AOT", resourceCulture); } } - + /// /// Looks up a localized string similar to Disabling the interpreter; using the interpreter and AOT at the same time is not supported. Use the interpreter for hot reload support in Debug configurations and AOT for Release configurations.. /// @@ -419,7 +419,7 @@ public static string XA0119_Interpreter { return ResourceManager.GetString("XA0119_Interpreter", resourceCulture); } } - + /// /// Looks up a localized string similar to Using fast deployment and the linker at the same time is not recommended. Use fast deployment for Debug configurations and the linker for Release configurations.. /// @@ -428,7 +428,7 @@ public static string XA0119_LinkMode { return ResourceManager.GetString("XA0119_LinkMode", resourceCulture); } } - + /// /// Looks up a localized string similar to Using fast deployment and a code shrinker at the same time is not recommended. Use fast deployment for Debug configurations and a code shrinker for Release configurations.. /// @@ -437,7 +437,7 @@ public static string XA0119_LinkTool { return ResourceManager.GetString("XA0119_LinkTool", resourceCulture); } } - + /// /// Looks up a localized string similar to Assembly '{0}' is using '[assembly: {1}]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.. /// @@ -446,7 +446,7 @@ public static string XA0121 { return ResourceManager.GetString("XA0121", resourceCulture); } } - + /// /// Looks up a localized string similar to Assembly '{0}' is using a deprecated attribute '[assembly: {1}]'. Use a newer version of this NuGet package or notify the library author.. /// @@ -455,7 +455,7 @@ public static string XA0122 { return ResourceManager.GetString("XA0122", resourceCulture); } } - + /// /// Looks up a localized string similar to Removing {0} from {1}. Lint {2} does not support this check.. /// @@ -464,7 +464,7 @@ public static string XA0123 { return ResourceManager.GetString("XA0123", resourceCulture); } } - + /// /// Looks up a localized string similar to '{0}' is using a deprecated debug information level. ///Set the debugging information to Portable in the Visual Studio project property pages or edit the project file in a text editor and set the 'DebugType' MSBuild property to 'portable' to use the newer, cross-platform debug information level. @@ -475,7 +475,7 @@ public static string XA0125 { return ResourceManager.GetString("XA0125", resourceCulture); } } - + /// /// Looks up a localized string similar to There was a problem parsing {0}. This is likely due to incomplete or invalid XML. Exception: {1}. /// @@ -484,7 +484,7 @@ public static string XA1000 { return ResourceManager.GetString("XA1000", resourceCulture); } } - + /// /// Looks up a localized string similar to AndroidResgen: Warning while updating resource XML '{0}': {1}. /// @@ -493,7 +493,7 @@ public static string XA1001 { return ResourceManager.GetString("XA1001", resourceCulture); } } - + /// /// Looks up a localized string similar to The closest match found for '{0}' is '{1}', but the capitalization does not match. Please correct the capitalization.. /// @@ -502,7 +502,7 @@ public static string XA1002 { return ResourceManager.GetString("XA1002", resourceCulture); } } - + /// /// Looks up a localized string similar to Attempting basic type name matching for element with ID '{0}' and type '{1}'. /// @@ -511,7 +511,7 @@ public static string XA1005 { return ResourceManager.GetString("XA1005", resourceCulture); } } - + /// /// Looks up a localized string similar to If basic type name matching fails, please add a `xamarin:managedType` attribute to the element to specify the fully qualified managed type name of the element.. /// @@ -520,7 +520,7 @@ public static string XA1005_Instructions { return ResourceManager.GetString("XA1005_Instructions", resourceCulture); } } - + /// /// Looks up a localized string similar to The TargetFrameworkVersion (Android API level {0}) is higher than the targetSdkVersion ({1}). Please increase the `android:targetSdkVersion` in the `AndroidManifest.xml` so that the API levels match.. /// @@ -529,7 +529,7 @@ public static string XA1006 { return ResourceManager.GetString("XA1006", resourceCulture); } } - + /// /// Looks up a localized string similar to The minSdkVersion ({0}) is greater than the targetSdkVersion. Please change the value such that the minSdkVersion is less than or equal to the targetSdkVersion ({1}).. /// @@ -538,7 +538,7 @@ public static string XA1007 { return ResourceManager.GetString("XA1007", resourceCulture); } } - + /// /// Looks up a localized string similar to The TargetFrameworkVersion (Android API level {0}) is lower than the targetSdkVersion ({1}). Please increase the `$(TargetFrameworkVersion)` or decrease the `android:targetSdkVersion` in the `AndroidManifest.xml` so that the API levels match.. /// @@ -547,7 +547,7 @@ public static string XA1008 { return ResourceManager.GetString("XA1008", resourceCulture); } } - + /// /// Looks up a localized string similar to Invalid `$(AndroidManifestPlaceholders)` value for Android manifest placeholders. Please use `key1=value1;key2=value2` format. The specified value was: `{0}`. /// @@ -556,7 +556,7 @@ public static string XA1010 { return ResourceManager.GetString("XA1010", resourceCulture); } } - + /// /// Looks up a localized string similar to Using ProGuard with the D8 DEX compiler is no longer supported. Please set the code shrinker to 'r8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidLinkTool' MSBuild property to 'r8'.. /// @@ -565,7 +565,7 @@ public static string XA1011 { return ResourceManager.GetString("XA1011", resourceCulture); } } - + /// /// Looks up a localized string similar to Included layout root element override ID '{0}' is not valid.. /// @@ -574,7 +574,7 @@ public static string XA1012 { return ResourceManager.GetString("XA1012", resourceCulture); } } - + /// /// Looks up a localized string similar to Failed to parse ID of node '{0}' in the layout file '{1}'.. /// @@ -583,7 +583,7 @@ public static string XA1013 { return ResourceManager.GetString("XA1013", resourceCulture); } } - + /// /// Looks up a localized string similar to JAR library references with identical file names but different contents were found: {0}. Please remove any conflicting libraries from EmbeddedJar, InputJar and AndroidJavaLibrary.. /// @@ -592,7 +592,7 @@ public static string XA1014 { return ResourceManager.GetString("XA1014", resourceCulture); } } - + /// /// Looks up a localized string similar to More than one Android Wear project is specified as the paired project. It can be at most one.. /// @@ -601,7 +601,7 @@ public static string XA1015 { return ResourceManager.GetString("XA1015", resourceCulture); } } - + /// /// Looks up a localized string similar to Target Wear application's project '{0}' does not specify required 'AndroidManifest' project property.. /// @@ -610,7 +610,7 @@ public static string XA1016 { return ResourceManager.GetString("XA1016", resourceCulture); } } - + /// /// Looks up a localized string similar to Target Wear application's AndroidManifest.xml does not specify required 'package' attribute.. /// @@ -619,7 +619,7 @@ public static string XA1017 { return ResourceManager.GetString("XA1017", resourceCulture); } } - + /// /// Looks up a localized string similar to Specified AndroidManifest file does not exist: {0}.. /// @@ -628,7 +628,7 @@ public static string XA1018 { return ResourceManager.GetString("XA1018", resourceCulture); } } - + /// /// Looks up a localized string similar to `LibraryProjectProperties` file `{0}` is located in a parent directory of the bindings project's intermediate output directory. Please adjust the path to use the original `project.properties` file directly from the Android library project directory.. /// @@ -637,7 +637,7 @@ public static string XA1019 { return ResourceManager.GetString("XA1019", resourceCulture); } } - + /// /// Looks up a localized string similar to At least one Java library is required for binding. Check that a Java library is included in the project and has the appropriate build action: 'LibraryProjectZip' (for AAR or ZIP), 'EmbeddedJar', 'InputJar' (for JAR), or 'LibraryProjectProperties' (project.properties).. /// @@ -646,7 +646,7 @@ public static string XA1020 { return ResourceManager.GetString("XA1020", resourceCulture); } } - + /// /// Looks up a localized string similar to Specified source Java library not found: {0}. /// @@ -655,7 +655,7 @@ public static string XA1021 { return ResourceManager.GetString("XA1021", resourceCulture); } } - + /// /// Looks up a localized string similar to Specified reference Java library not found: {0}. /// @@ -664,7 +664,7 @@ public static string XA1022 { return ResourceManager.GetString("XA1022", resourceCulture); } } - + /// /// Looks up a localized string similar to Using the DX DEX Compiler is not supported. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.. /// @@ -673,7 +673,7 @@ public static string XA1023 { return ResourceManager.GetString("XA1023", resourceCulture); } } - + /// /// Looks up a localized string similar to Ignoring configuration file '{0}'. .NET configuration files are not supported in Xamarin.Android projects that target .NET 6 or higher.. /// @@ -682,7 +682,7 @@ public static string XA1024 { return ResourceManager.GetString("XA1024", resourceCulture); } } - + /// /// Looks up a localized string similar to The experimental 'Hybrid' value for the 'AndroidAotMode' MSBuild property is not currently compatible with the armeabi-v7a target ABI. To continue using the experimental 'Hybrid' value for 'AndroidAotMode', deselect the armeabi-v7a target ABI in the Visual Studio project property pages or edit the project file in a text editor and remove 'armeabi-v7a' from the 'AndroidSupportedAbis' MSBuild property.. /// @@ -691,7 +691,7 @@ public static string XA1025 { return ResourceManager.GetString("XA1025", resourceCulture); } } - + /// /// Looks up a localized string similar to Using AAPT is deprecated in favor of AAPT2. Please enable 'Use incremental Android packaging system (aapt2)' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidUseAapt2' MSBuild property to 'true'.. /// @@ -700,7 +700,7 @@ public static string XA1026 { return ResourceManager.GetString("XA1026", resourceCulture); } } - + /// /// Looks up a localized string similar to Using AAPT is not supported in Xamarin.Android projects that target .NET 6 or higher. Please enable 'Use incremental Android packaging system (aapt2)' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidUseAapt2' MSBuild property to 'true'.. /// @@ -709,7 +709,7 @@ public static string XA1026_dotnet { return ResourceManager.GetString("XA1026_dotnet", resourceCulture); } } - + /// /// Looks up a localized string similar to The 'EnableProguard' MSBuild property is set to 'true' and the 'AndroidLinkTool' MSBuild property is empty, so 'AndroidLinkTool' will default to 'proguard'.. /// @@ -718,7 +718,7 @@ public static string XA1027 { return ResourceManager.GetString("XA1027", resourceCulture); } } - + /// /// Looks up a localized string similar to The 'AndroidEnableProguard' MSBuild property is set to 'true' and the 'AndroidLinkTool' MSBuild property is empty, so 'AndroidLinkTool' will default to 'proguard'.. /// @@ -727,7 +727,7 @@ public static string XA1028 { return ResourceManager.GetString("XA1028", resourceCulture); } } - + /// /// Looks up a localized string similar to Use of AppDomain.CreateDomain() detected in assembly: {0}. .NET 6 and higher will only support a single AppDomain, so this API will no longer be available in Xamarin.Android once .NET 6 is released.. /// @@ -736,7 +736,7 @@ public static string XA2000 { return ResourceManager.GetString("XA2000", resourceCulture); } } - + /// /// Looks up a localized string similar to Support for the 'MONO_GC_PARAMS=bridge-implementation=old' value will be removed in .NET 7.. /// @@ -745,7 +745,7 @@ public static string XA2000_gcParams_bridgeImpl { return ResourceManager.GetString("XA2000_gcParams_bridgeImpl", resourceCulture); } } - + /// /// Looks up a localized string similar to Source file '{0}' could not be found.. /// @@ -754,7 +754,7 @@ public static string XA2001 { return ResourceManager.GetString("XA2001", resourceCulture); } } - + /// /// Looks up a localized string similar to Can not resolve reference: `{0}`, referenced by {1}. Perhaps it doesn't exist in the Mono for Android profile?. /// @@ -763,7 +763,7 @@ public static string XA2002_Framework { return ResourceManager.GetString("XA2002_Framework", resourceCulture); } } - + /// /// Looks up a localized string similar to Can not resolve reference: `{0}`, referenced by {1}. Please add a NuGet package or assembly reference for `{0}`, or remove the reference to `{2}`.. /// @@ -772,7 +772,7 @@ public static string XA2002_NuGet { return ResourceManager.GetString("XA2002_NuGet", resourceCulture); } } - + /// /// Looks up a localized string similar to Could not resolve reference to '{0}' (defined in assembly '{1}') with scope '{2}'. When the scope is different from the defining assembly, it usually means that the type is forwarded.. /// @@ -781,7 +781,7 @@ public static string XA2006 { return ResourceManager.GetString("XA2006", resourceCulture); } } - + /// /// Looks up a localized string similar to Exception while loading assemblies: {0}. /// @@ -790,7 +790,7 @@ public static string XA2007 { return ResourceManager.GetString("XA2007", resourceCulture); } } - + /// /// Looks up a localized string similar to In referenced assembly {0}, Java.Interop.DoNotPackageAttribute requires non-null file name.. /// @@ -799,7 +799,7 @@ public static string XA2008 { return ResourceManager.GetString("XA2008", resourceCulture); } } - + /// /// Looks up a localized string similar to Could not AOT the assembly: {0}. /// @@ -808,7 +808,7 @@ public static string XA3001 { return ResourceManager.GetString("XA3001", resourceCulture); } } - + /// /// Looks up a localized string similar to Invalid AOT mode: {0}. /// @@ -817,7 +817,7 @@ public static string XA3002 { return ResourceManager.GetString("XA3002", resourceCulture); } } - + /// /// Looks up a localized string similar to Could not strip IL of assembly: {0}. /// @@ -826,7 +826,7 @@ public static string XA3003 { return ResourceManager.GetString("XA3003", resourceCulture); } } - + /// /// Looks up a localized string similar to Android NDK r10d is buggy and provides an incompatible x86_64 libm.so. See https://code.google.com/p/android/issues/detail?id=161422.. /// @@ -835,7 +835,7 @@ public static string XA3004 { return ResourceManager.GetString("XA3004", resourceCulture); } } - + /// /// Looks up a localized string similar to The detected Android NDK version is incompatible with the targeted LLVM configuration. Please upgrade to NDK r10d or newer.. /// @@ -844,7 +844,7 @@ public static string XA3005 { return ResourceManager.GetString("XA3005", resourceCulture); } } - + /// /// Looks up a localized string similar to Could not compile native assembly file: {0}. /// @@ -853,7 +853,7 @@ public static string XA3006 { return ResourceManager.GetString("XA3006", resourceCulture); } } - + /// /// Looks up a localized string similar to Could not link native shared library: {0}. /// @@ -862,7 +862,7 @@ public static string XA3007 { return ResourceManager.GetString("XA3007", resourceCulture); } } - + /// /// Looks up a localized string similar to Failed to generate Java type for class: {0} due to {1}. /// @@ -871,7 +871,7 @@ public static string XA4209 { return ResourceManager.GetString("XA4209", resourceCulture); } } - + /// /// Looks up a localized string similar to Please add a reference to Mono.Android.Export.dll when using ExportAttribute or ExportFieldAttribute.. /// @@ -880,7 +880,7 @@ public static string XA4210 { return ResourceManager.GetString("XA4210", resourceCulture); } } - + /// /// Looks up a localized string similar to AndroidManifest.xml //uses-sdk/@android:targetSdkVersion '{0}' is less than $(TargetFrameworkVersion) '{1}'. Using API-{2} for ACW compilation.. /// @@ -889,7 +889,7 @@ public static string XA4211 { return ResourceManager.GetString("XA4211", resourceCulture); } } - + /// /// Looks up a localized string similar to The type '{0}' must provide a public default constructor. /// @@ -898,7 +898,7 @@ public static string XA4213 { return ResourceManager.GetString("XA4213", resourceCulture); } } - + /// /// Looks up a localized string similar to The managed type `{0}` exists in multiple assemblies: {1}. Please refactor the managed type names in these assemblies so that they are not identical.. /// @@ -907,7 +907,7 @@ public static string XA4214 { return ResourceManager.GetString("XA4214", resourceCulture); } } - + /// /// Looks up a localized string similar to References to the type `{0}` will refer to `{0}, {1}`.. /// @@ -916,7 +916,7 @@ public static string XA4214_Result { return ResourceManager.GetString("XA4214_Result", resourceCulture); } } - + /// /// Looks up a localized string similar to The Java type `{0}` is generated by more than one managed type. Please change the [Register] attribute so that the same Java type is not emitted.. /// @@ -925,7 +925,7 @@ public static string XA4215 { return ResourceManager.GetString("XA4215", resourceCulture); } } - + /// /// Looks up a localized string similar to `{0}` generated by: {1}. /// @@ -934,7 +934,7 @@ public static string XA4215_Details { return ResourceManager.GetString("XA4215_Details", resourceCulture); } } - + /// /// Looks up a localized string similar to AndroidManifest.xml //uses-sdk/@android:minSdkVersion '{0}' is less than API-{1}, this configuration is not supported.. /// @@ -943,7 +943,7 @@ public static string XA4216_MinSdkVersion { return ResourceManager.GetString("XA4216_MinSdkVersion", resourceCulture); } } - + /// /// Looks up a localized string similar to AndroidManifest.xml //uses-sdk/@android:targetSdkVersion '{0}' is less than API-{1}, this configuration is not supported.. /// @@ -952,7 +952,7 @@ public static string XA4216_TargetSdkVersion { return ResourceManager.GetString("XA4216_TargetSdkVersion", resourceCulture); } } - + /// /// Looks up a localized string similar to Unable to find //manifest/application/uses-library at path: {0}. /// @@ -961,7 +961,7 @@ public static string XA4218 { return ResourceManager.GetString("XA4218", resourceCulture); } } - + /// /// Looks up a localized string similar to Cannot find binding generator for language {0} or {1}.. /// @@ -970,7 +970,7 @@ public static string XA4219 { return ResourceManager.GetString("XA4219", resourceCulture); } } - + /// /// Looks up a localized string similar to Partial class item '{0}' does not have an associated binding for layout '{1}'.. /// @@ -979,7 +979,7 @@ public static string XA4220 { return ResourceManager.GetString("XA4220", resourceCulture); } } - + /// /// Looks up a localized string similar to No layout binding source files were generated.. /// @@ -988,7 +988,7 @@ public static string XA4221 { return ResourceManager.GetString("XA4221", resourceCulture); } } - + /// /// Looks up a localized string similar to No widgets found for layout ({0}).. /// @@ -997,7 +997,7 @@ public static string XA4222 { return ResourceManager.GetString("XA4222", resourceCulture); } } - + /// /// Looks up a localized string similar to Malformed full class name '{0}'. Missing namespace.. /// @@ -1006,7 +1006,7 @@ public static string XA4223 { return ResourceManager.GetString("XA4223", resourceCulture); } } - + /// /// Looks up a localized string similar to Malformed full class name '{0}'. Missing class name.. /// @@ -1015,7 +1015,7 @@ public static string XA4224 { return ResourceManager.GetString("XA4224", resourceCulture); } } - + /// /// Looks up a localized string similar to Widget '{0}' in layout '{1}' has multiple instances with different types. The property type will be set to: {2}. /// @@ -1024,7 +1024,7 @@ public static string XA4225 { return ResourceManager.GetString("XA4225", resourceCulture); } } - + /// /// Looks up a localized string similar to Resource item '{0}' does not have the required metadata item '{1}'.. /// @@ -1033,7 +1033,7 @@ public static string XA4226 { return ResourceManager.GetString("XA4226", resourceCulture); } } - + /// /// Looks up a localized string similar to Unable to find specified //activity-alias/@android:targetActivity: '{0}'. /// @@ -1042,7 +1042,7 @@ public static string XA4228 { return ResourceManager.GetString("XA4228", resourceCulture); } } - + /// /// Looks up a localized string similar to Unrecognized `TransformFile` root element: {0}.. /// @@ -1051,7 +1051,7 @@ public static string XA4229 { return ResourceManager.GetString("XA4229", resourceCulture); } } - + /// /// Looks up a localized string similar to Error parsing XML: {0}. /// @@ -1060,7 +1060,7 @@ public static string XA4230 { return ResourceManager.GetString("XA4230", resourceCulture); } } - + /// /// Looks up a localized string similar to The Android class parser value '{0}' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'class-parse'.. /// @@ -1069,7 +1069,7 @@ public static string XA4231 { return ResourceManager.GetString("XA4231", resourceCulture); } } - + /// /// Looks up a localized string similar to The Android code generation target '{0}' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'XAJavaInterop1'.. /// @@ -1078,7 +1078,7 @@ public static string XA4232 { return ResourceManager.GetString("XA4232", resourceCulture); } } - + /// /// Looks up a localized string similar to The <AndroidNamespaceReplacement> for '{0}' does not specify a 'Replacement' attribute.. /// @@ -1087,7 +1087,7 @@ public static string XA4233 { return ResourceManager.GetString("XA4233", resourceCulture); } } - + /// /// Looks up a localized string similar to Native library '{0}' will not be bundled because it has an unsupported ABI. Move this file to a directory with a valid Android ABI name such as 'libs/armeabi-v7a/'.. /// @@ -1096,7 +1096,7 @@ public static string XA4300 { return ResourceManager.GetString("XA4300", resourceCulture); } } - + /// /// Looks up a localized string similar to APK already contains the item {0}; ignoring.. /// @@ -1105,7 +1105,7 @@ public static string XA4301 { return ResourceManager.GetString("XA4301", resourceCulture); } } - + /// /// Looks up a localized string similar to Cannot determine ABI of native library '{0}'. Move this file to a directory with a valid Android ABI name such as 'libs/armeabi-v7a/'.. /// @@ -1114,7 +1114,7 @@ public static string XA4301_ABI { return ResourceManager.GetString("XA4301_ABI", resourceCulture); } } - + /// /// Looks up a localized string similar to Could not determine ABI of some native libraries. Ignoring those: {0}. /// @@ -1123,7 +1123,7 @@ public static string XA4301_ABI_Ignoring { return ResourceManager.GetString("XA4301_ABI_Ignoring", resourceCulture); } } - + /// /// Looks up a localized string similar to Cannot determine ABI of native library '{0}'. Remove the '{1}' NuGet package, or notify the library author.. /// @@ -1132,7 +1132,7 @@ public static string XA4301_ABI_NuGet { return ResourceManager.GetString("XA4301_ABI_NuGet", resourceCulture); } } - + /// /// Looks up a localized string similar to Unhandled exception merging `AndroidManifest.xml`: {0}. /// @@ -1141,7 +1141,7 @@ public static string XA4302 { return ResourceManager.GetString("XA4302", resourceCulture); } } - + /// /// Looks up a localized string similar to Error extracting resources from "{0}": {1}. /// @@ -1150,7 +1150,7 @@ public static string XA4303 { return ResourceManager.GetString("XA4303", resourceCulture); } } - + /// /// Looks up a localized string similar to ProGuard configuration file '{0}' was not found.. /// @@ -1159,7 +1159,7 @@ public static string XA4304 { return ResourceManager.GetString("XA4304", resourceCulture); } } - + /// /// Looks up a localized string similar to Multidex is enabled, but `$(_AndroidMainDexListFile)` is empty.. /// @@ -1168,7 +1168,7 @@ public static string XA4305 { return ResourceManager.GetString("XA4305", resourceCulture); } } - + /// /// Looks up a localized string similar to Multidex is enabled, but the `$(_AndroidMainDexListFile)` file '{0}' does not exist.. /// @@ -1177,7 +1177,7 @@ public static string XA4305_File_Missing { return ResourceManager.GetString("XA4305_File_Missing", resourceCulture); } } - + /// /// Looks up a localized string similar to R8 does not support `@(MultiDexMainDexList)` files when android:minSdkVersion >= 21. /// @@ -1186,7 +1186,7 @@ public static string XA4306 { return ResourceManager.GetString("XA4306", resourceCulture); } } - + /// /// Looks up a localized string similar to Invalid ProGuard configuration file. {0}. /// @@ -1195,7 +1195,7 @@ public static string XA4307 { return ResourceManager.GetString("XA4307", resourceCulture); } } - + /// /// Looks up a localized string similar to Failed to generate type maps. /// @@ -1204,7 +1204,7 @@ public static string XA4308 { return ResourceManager.GetString("XA4308", resourceCulture); } } - + /// /// Looks up a localized string similar to 'MultiDexMainDexList' file '{0}' does not exist.. /// @@ -1213,7 +1213,7 @@ public static string XA4309 { return ResourceManager.GetString("XA4309", resourceCulture); } } - + /// /// Looks up a localized string similar to `{0}` file `{1}` could not be found.. /// @@ -1222,7 +1222,7 @@ public static string XA4310 { return ResourceManager.GetString("XA4310", resourceCulture); } } - + /// /// Looks up a localized string similar to The application won't contain the paired Wear package because the Wear application package APK is not created yet. If building on the command line, be sure to build the "SignAndroidPackage" target.. /// @@ -1231,7 +1231,7 @@ public static string XA4311 { return ResourceManager.GetString("XA4311", resourceCulture); } } - + /// /// Looks up a localized string similar to Referencing the Android Wear application project '{0}' from an Android application project is deprecated and will no longer be supported in a future version of Xamarin.Android. Remove the Android Wear application project reference from the Android application project and distribute the Wear application as a standalone application instead.. /// @@ -1240,7 +1240,7 @@ public static string XA4312 { return ResourceManager.GetString("XA4312", resourceCulture); } } - + /// /// Looks up a localized string similar to The built-in '{0}' reference has been deprecated. ///Remove the '{0}' reference from your project and add the '{1}' NuGet package instead. @@ -1251,7 +1251,7 @@ public static string XA4313 { return ResourceManager.GetString("XA4313", resourceCulture); } } - + /// /// Looks up a localized string similar to `{0}` is empty. A value for `{0}` should be provided.. /// @@ -1260,7 +1260,7 @@ public static string XA4314 { return ResourceManager.GetString("XA4314", resourceCulture); } } - + /// /// Looks up a localized string similar to Missing Android NDK toolchains directory '{0}'. Please install the Android NDK.. /// @@ -1269,7 +1269,7 @@ public static string XA5101 { return ResourceManager.GetString("XA5101", resourceCulture); } } - + /// /// Looks up a localized string similar to C compiler for target {0} was not found. Tried paths: "{1}". /// @@ -1278,7 +1278,7 @@ public static string XA5101_C_Compiler { return ResourceManager.GetString("XA5101_C_Compiler", resourceCulture); } } - + /// /// Looks up a localized string similar to Toolchain directory for target {0} was not found.. /// @@ -1287,7 +1287,7 @@ public static string XA5101_Toolchain { return ResourceManager.GetString("XA5101_Toolchain", resourceCulture); } } - + /// /// Looks up a localized string similar to Conversion from assembly to native code failed. Exit code {0}. /// @@ -1296,7 +1296,7 @@ public static string XA5102 { return ResourceManager.GetString("XA5102", resourceCulture); } } - + /// /// Looks up a localized string similar to NDK C compiler exited with an error. Exit code {0}. /// @@ -1305,7 +1305,7 @@ public static string XA5103 { return ResourceManager.GetString("XA5103", resourceCulture); } } - + /// /// Looks up a localized string similar to Could not locate the Android NDK. Please make sure the Android NDK is installed in the Android SDK Manager, or if using a custom NDK path, please ensure the $(AndroidNdkDirectory) MSBuild property is set to the custom path.. /// @@ -1314,7 +1314,7 @@ public static string XA5104 { return ResourceManager.GetString("XA5104", resourceCulture); } } - + /// /// Looks up a localized string similar to Toolchain utility '{0}' for target {1} was not found. Tried in path: "{2}". /// @@ -1323,7 +1323,7 @@ public static string XA5105 { return ResourceManager.GetString("XA5105", resourceCulture); } } - + /// /// Looks up a localized string similar to NDK linker exited with an error. Exit code {0}. /// @@ -1332,7 +1332,7 @@ public static string XA5201 { return ResourceManager.GetString("XA5201", resourceCulture); } } - + /// /// Looks up a localized string similar to Cannot find `{0}`. Please install the Android SDK Build-Tools package with the `{1}{2}tools{2}{3}` program.. /// @@ -1341,7 +1341,7 @@ public static string XA5205 { return ResourceManager.GetString("XA5205", resourceCulture); } } - + /// /// Looks up a localized string similar to Cannot find `{0}` in the Android SDK. Please set its path via /p:LintToolPath.. /// @@ -1350,7 +1350,7 @@ public static string XA5205_Lint { return ResourceManager.GetString("XA5205_Lint", resourceCulture); } } - + /// /// Looks up a localized string similar to Could not find android.jar for API level {0}. This means the Android SDK platform for API level {0} is not installed. Either install it in the Android SDK Manager ({2}), or change the Xamarin.Android project to target an API version that is installed. ({1} missing.). /// @@ -1359,7 +1359,7 @@ public static string XA5207 { return ResourceManager.GetString("XA5207", resourceCulture); } } - + /// /// Looks up a localized string similar to Tools > Open Android SDK Manager.... /// @@ -1368,7 +1368,7 @@ public static string XA5207_SDK_Manager_macOS { return ResourceManager.GetString("XA5207_SDK_Manager_macOS", resourceCulture); } } - + /// /// Looks up a localized string similar to Tools > Android > Android SDK Manager.... /// @@ -1377,7 +1377,7 @@ public static string XA5207_SDK_Manager_Windows { return ResourceManager.GetString("XA5207_SDK_Manager_Windows", resourceCulture); } } - + /// /// Looks up a localized string similar to Embedded Wear app package name differs from handheld app package name ({0} != {1}).. /// @@ -1386,7 +1386,7 @@ public static string XA5211 { return ResourceManager.GetString("XA5211", resourceCulture); } } - + /// /// Looks up a localized string similar to java.lang.OutOfMemoryError. Consider increasing the value of $(JavaMaximumHeapSize). Java ran out of memory while executing '{0} {1}'. /// @@ -1395,7 +1395,7 @@ public static string XA5213 { return ResourceManager.GetString("XA5213", resourceCulture); } } - + /// /// Looks up a localized string similar to No Android platforms installed at '{0}'. Please install an SDK Platform with the `{1}{2}tools{2}{3}` program.. /// @@ -1404,7 +1404,7 @@ public static string XA5300_Android_Platforms { return ResourceManager.GetString("XA5300_Android_Platforms", resourceCulture); } } - + /// /// Looks up a localized string similar to The Android SDK directory could not be found. Check that the Android SDK Manager in Visual Studio shows a valid installation. To use a custom SDK path for a command line build, set the 'AndroidSdkDirectory' MSBuild property to the custom path.. /// @@ -1413,7 +1413,7 @@ public static string XA5300_Android_SDK { return ResourceManager.GetString("XA5300_Android_SDK", resourceCulture); } } - + /// /// Looks up a localized string similar to The Java SDK directory could not be found. Ensure that the Android section of the Visual Studio options has a valid Java SDK directory configured. To use a custom SDK path for a command line build, set the 'JavaSdkDirectory' MSBuild property to the custom path.. /// @@ -1422,7 +1422,7 @@ public static string XA5300_Java_SDK { return ResourceManager.GetString("XA5300_Java_SDK", resourceCulture); } } - + /// /// Looks up a localized string similar to Failed to generate Java type for class: {0} due to MAX_PATH: {1}. /// @@ -1431,7 +1431,7 @@ public static string XA5301 { return ResourceManager.GetString("XA5301", resourceCulture); } } - + /// /// Looks up a localized string similar to Two processes may be building this project at once. Lock file exists at path: {0}. /// @@ -1440,5 +1440,32 @@ public static string XA5302 { return ResourceManager.GetString("XA5302", resourceCulture); } } + + /// + /// Looks up a localized string similar to Two processes may be building this project at once. Lock file exists at path: {0}. + /// + public static string XA1031 { + get { + return ResourceManager.GetString("XA1031", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Two processes may be building this project at once. Lock file exists at path: {0}. + /// + public static string XA1032 { + get { + return ResourceManager.GetString("XA1032", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Two processes may be building this project at once. Lock file exists at path: {0}. + /// + public static string XA1033 { + get { + return ResourceManager.GetString("XA1033", resourceCulture); + } + } } } diff --git a/src/Xamarin.Android.Build.Tasks/Properties/Resources.resx b/src/Xamarin.Android.Build.Tasks/Properties/Resources.resx index 0edc1651fc5..ac48bbe6967 100644 --- a/src/Xamarin.Android.Build.Tasks/Properties/Resources.resx +++ b/src/Xamarin.Android.Build.Tasks/Properties/Resources.resx @@ -470,6 +470,24 @@ In this message, the term "binding" means a piece of generated code that makes i The 'RunAOTCompilation' MSBuild property is only supported when trimming is enabled. Edit the project file in a text editor to set 'PublishTrimmed' to 'true' for this build configuration. The following are literal names and should not be translated: 'RunAOTCompilation', 'PublishTrimmed' + + The 'AndroidHttpClientHandlerType' property value '{0}' must derive from '{1}'. +Please change the value to an assembly-qualifed type name which inherits from '{1}' or remove the property completely. + The following are literal names and should not be translated: 'AndroidHttpClientHandlerType', +{0} - The value of the property. +{1} - A type from which the AndroidHttpClientHandlerType should derive . + + + Failed to resolve '{0}' from '{1}'. Please check your `AndroidHttpClientHandlerType` setting. + The following are literal names and should not be translated: 'AndroidHttpClientHandlerType', +{0} - The value of the property. +{1} - The name of the assembly. + + + Could not resolve '{0}'. Please check your `AndroidHttpClientHandlerType` setting. + The following are literal names and should not be translated: 'AndroidHttpClientHandlerType', +{0} - The value of the property. + Use of AppDomain.CreateDomain() detected in assembly: {0}. .NET 6 and higher will only support a single AppDomain, so this API will no longer be available in Xamarin.Android once .NET 6 is released. The following are literal names and should not be translated: AppDomain.CreateDomain(), AppDomain diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/CheckClientHandlerType.cs b/src/Xamarin.Android.Build.Tasks/Tasks/CheckClientHandlerType.cs new file mode 100644 index 00000000000..58d8048abe3 --- /dev/null +++ b/src/Xamarin.Android.Build.Tasks/Tasks/CheckClientHandlerType.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; +using System.IO; +using Microsoft.Android.Build.Tasks; +using Java.Interop.Tools.Cecil; +using Mono.Cecil; + +namespace Xamarin.Android.Tasks +{ + public class CheckClientHandlerType : AndroidTask + { + public override string TaskPrefix => "CCHT"; + + [Required] + public string ClientHandlerType { get; set; } + [Required] + public string ValidHandlerType { get; set; } + [Required] + public ITaskItem[] ResolvedAssemblies { get; set; } + + public bool IsLinkerEnabled { get; set; } + + public override bool RunTask () + { + string[] types = ClientHandlerType.Split (','); + string type = types[0].Trim (); + string assembly = "Mono.Android"; + + if (types.Length > 1) { + assembly = types[1].Trim (); + } + // load the assembly. + ITaskItem foundAssembly = null; + foreach (var asm in ResolvedAssemblies) { + string filename = Path.GetFileNameWithoutExtension (asm.ItemSpec); + if (string.CompareOrdinal (assembly, filename) == 0) { + foundAssembly = asm; + break; + } + } + if (foundAssembly == null) { + Log.LogCodedError ("XA1033", Xamarin.Android.Tasks.Properties.Resources.XA1033, assembly); + return !Log.HasLoggedErrors; + } + // find the type. + var readerParameters = new ReaderParameters { + ReadSymbols = false, + }; + using (var resolver = new DirectoryAssemblyResolver (this.CreateTaskLogger (), loadDebugSymbols: false, loadReaderParameters: readerParameters)) { + foreach (var asm in ResolvedAssemblies) { + var path = Path.GetFullPath (Path.GetDirectoryName (asm.ItemSpec)); + if (!resolver.SearchDirectories.Contains (path)) { + resolver.SearchDirectories.Add (path); + } + } + + var assemblyDefinition = resolver.GetAssembly (Path.GetFullPath (foundAssembly.ItemSpec)); + TypeDefinition handlerType = null; + foreach (var model in assemblyDefinition.Modules) { + handlerType = assemblyDefinition.MainModule.GetType (type); + if (handlerType != null) + break; + } + if (handlerType == null) { + if (IsLinkerEnabled) { + Log.LogDebugMessage ("Could not resolve '{type}' from '{assembly}'. It was probably linked out during the build."); + return true; + } + Log.LogCodedError ("XA1032", Xamarin.Android.Tasks.Properties.Resources.XA1032, type, assembly); + return false; + } + + string[] valueHandlerTypes = ValidHandlerType.Split (','); + if (!Extends (handlerType, valueHandlerTypes [0].Trim ())) { + Log.LogCodedError ("XA1031", Xamarin.Android.Tasks.Properties.Resources.XA1031, type, valueHandlerTypes [0]); + } + + return !Log.HasLoggedErrors; + } + } + + static bool Extends (TypeDefinition type, string validBase) { + var bt = type.Resolve (); + while (bt != null) { + if (bt.FullName == validBase) + return true; + bt = bt.BaseType?.Resolve () ?? null; + } + return false; + } + } +} diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/EnvironmentContentTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/EnvironmentContentTests.cs index b81f21fea37..4628d1533f5 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/EnvironmentContentTests.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/EnvironmentContentTests.cs @@ -194,6 +194,20 @@ public void CheckBuildIdIsUnique ([Values ("apk", "aab")] string packageFormat) } } + [Test] + public void CheckForInvalidHttpClientHandlerType () + { + var proj = new XamarinAndroidApplicationProject () { + IsRelease = true, + }; + using (var b = CreateApkBuilder ()) { + b.ThrowOnBuildFailure = false; + proj.SetProperty ("AndroidHttpClientHandlerType", "Android.App.Application"); + Assert.IsFalse (b.Build (proj), "Build should not have succeeded."); + Assert.IsTrue (StringAssertEx.ContainsText (b.LastBuildOutput, "XA1031"), "Output should contain XA1031"); + } + } + [Test] public void CheckHttpClientHandlerType () { @@ -203,8 +217,15 @@ public void CheckHttpClientHandlerType () var httpClientHandlerVarName = "XA_HTTP_CLIENT_HANDLER_TYPE"; var expectedDefaultValue = "System.Net.Http.HttpClientHandler, System.Net.Http"; var expectedUpdatedValue = "Xamarin.Android.Net.AndroidClientHandler"; + if (Builder.UseDotNet) { + expectedDefaultValue = "System.Net.Http.SocketsHttpHandler, System.Net.Http"; + expectedUpdatedValue = "Xamarin.Android.Net.AndroidMessageHandler"; + } + var supportedAbis = "armeabi-v7a;arm64-v8a"; proj.SetAndroidSupportedAbis (supportedAbis); + proj.PackageReferences.Add (new Package() { Id = "System.Net.Http", Version = "*" }); + proj.MainActivity = proj.DefaultMainActivity.Replace ("//${AFTER_ONCREATE}", "var _ = new System.Net.Http.HttpClient ();"); using (var b = CreateApkBuilder ()) { proj.SetProperty ("AndroidHttpClientHandlerType", expectedDefaultValue); diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/CheckClientHandlerTypeTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/CheckClientHandlerTypeTests.cs new file mode 100644 index 00000000000..c7c49809d6b --- /dev/null +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/CheckClientHandlerTypeTests.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; +using NUnit.Framework; +using Xamarin.Android.Tasks; +using Xamarin.Android.Tools; +using Xamarin.ProjectTools; +using Microsoft.Android.Build.Tasks; + +namespace Xamarin.Android.Build.Tests +{ + [Category ("Node-2")] + public class CheckClientHandlerTypeTests : BaseTest + { + [Test] + [TestCase ("Xamarin.Android.Net.AndroidMessageHandler", "System.Net.Http.HttpMessageHandler, System.Net.Http")] + [TestCase ("Xamarin.Android.Net.AndroidClientHandler", "System.Net.Http.HttpClientHandler, System.Net.Http")] + [TestCase ("System.Net.Http.SocketsHttpHandler, System.Net.Http", "System.Net.Http.HttpMessageHandler, System.Net.Http")] + public void ErrorIsNotRaised (string handler, string validBaseType) + { + string path = Path.Combine (Root, "temp", TestName); + Directory.CreateDirectory (path); + string intermediatePath; + var proj = new XamarinAndroidApplicationProject () { + IsRelease = false, + }; + proj.SetProperty ("AndroidHttpClientHandlerType", handler); + using (var b = CreateApkBuilder (path)) { + b.ThrowOnBuildFailure = false; + b.Build (proj); // we don't care it might error. + intermediatePath = Path.Combine (path,proj.IntermediateOutputPath); + } + string asmPath = Path.GetFullPath (Path.Combine (intermediatePath, "android", "assets")); + var errors = new List (); + var warnings = new List (); + List assemblies = new List (); + string[] files = Directory.GetFiles (asmPath, "*.dll"); + foreach (var file in files) + assemblies.Add (new TaskItem (file)); + IBuildEngine4 engine = new MockBuildEngine (System.Console.Out, errors, warnings); + var task = new CheckClientHandlerType () { + BuildEngine = engine, + ClientHandlerType = handler, + ResolvedAssemblies = assemblies.ToArray (), + ValidHandlerType = validBaseType, + }; + Assert.True (task.Execute (), $"task should have succeeded. {string.Join (";", errors.Select (x => x.Message))}"); + } + + [Test] +#if !NET_6 + [TestCase ("Xamarin.Android.Net.AndroidMessageHandler", "System.Net.Http.HttpClientHandler, System.Net.Http")] +#else + [TestCase ("Xamarin.Android.Net.AndroidClientHandler", "System.Net.Http.HttpMessageHandler, System.Net.Http")] +#endif + public void ErrorIsRaised (string handler, string validBaseType) + { + var path = Path.Combine (Root, "temp", TestName); + Directory.CreateDirectory (path); + string intermediatePath; + var proj = new XamarinAndroidApplicationProject () { + IsRelease = false, + }; + proj.SetProperty ("AndroidHttpClientHandlerType", handler); + using (var b = CreateApkBuilder ()) { + b.ThrowOnBuildFailure = false; + b.Build (proj); + intermediatePath = Path.Combine (path, proj.IntermediateOutputPath); + } + string asmPath = Path.Combine (intermediatePath, "android", "assets"); + var errors = new List (); + var warnings = new List (); + List assemblies = new List (); + string[] files = Directory.GetFiles (asmPath, "*.dll"); + foreach (var file in files) + assemblies.Add (new TaskItem (file)); + IBuildEngine4 engine = new MockBuildEngine (System.Console.Out, errors, warnings); + var task = new CheckClientHandlerType () { + BuildEngine = engine, + ClientHandlerType = handler, + ResolvedAssemblies = assemblies.ToArray (), + ValidHandlerType = validBaseType, + }; + Assert.False (task.Execute (), $"task should have failed."); + Assert.AreEqual (1, errors.Count, $"An Error should have been raised. {string.Join (" ", errors.Select (e => e.Message))}"); + } + } +} diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/LinkerTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/LinkerTests.cs index 0a630a47619..dae79f04cfd 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/LinkerTests.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/LinkerTests.cs @@ -170,13 +170,19 @@ private void PreserveCustomHttpClientHandler (string handlerType, string handler } [Test] - [Category ("DotNetIgnore")] // HttpClientHandler options not implemented in .NET 5+ yet public void PreserveCustomHttpClientHandlers () { - PreserveCustomHttpClientHandler ("Xamarin.Android.Net.AndroidClientHandler", "", - "temp/PreserveAndroidHttpClientHandler", "android/assets/Mono.Android.dll"); - PreserveCustomHttpClientHandler ("System.Net.Http.MonoWebRequestHandler", "System.Net.Http", - "temp/PreserveMonoWebRequestHandler", "android/assets/System.Net.Http.dll"); + if (Builder.UseDotNet) { + PreserveCustomHttpClientHandler ("Xamarin.Android.Net.AndroidMessageHandler", "", + "temp/PreserveAndroidMessageHandler", "android-arm64/linked/Mono.Android.dll"); + PreserveCustomHttpClientHandler ("System.Net.Http.SocketsHttpHandler", "System.Net.Http", + "temp/PreserveSocketsHttpHandler", "android-arm64/linked/System.Net.Http.dll"); + } else { + PreserveCustomHttpClientHandler ("Xamarin.Android.Net.AndroidClientHandler", "", + "temp/PreserveAndroidHttpClientHandler", "android/assets/Mono.Android.dll"); + PreserveCustomHttpClientHandler ("System.Net.Http.MonoWebRequestHandler", "System.Net.Http", + "temp/PreserveMonoWebRequestHandler", "android/assets/System.Net.Http.dll"); + } } [Test] diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/Builder.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/Builder.cs index 5f3d93bce01..8b83c2f7b51 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/Builder.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/Builder.cs @@ -47,7 +47,7 @@ public IEnumerable LastBuildOutput { } public TimeSpan LastBuildTime { get; protected set; } public string BuildLogFile { get; set; } - public bool ThrowOnBuildFailure { get; set; } + public bool ThrowOnBuildFailure { get; set; } = true; /// /// True if NuGet restore occurs automatically (default) /// diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/ProjectBuilder.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/ProjectBuilder.cs index 0d4f1f3fbcb..9ad75e4db5c 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/ProjectBuilder.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/ProjectBuilder.cs @@ -14,7 +14,6 @@ public ProjectBuilder (string projectDirectory) { ProjectDirectory = projectDirectory; Target = "Build"; - ThrowOnBuildFailure = true; BuildLogFile = "build.log"; } diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets index f711d009251..5a149fdce2f 100644 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets @@ -38,6 +38,7 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved. + @@ -488,6 +489,20 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved. + + + System.Net.Http.HttpClientHandler, System.Net.Http + System.Net.Http.HttpMessageHandler, System.Net.Http + + + + Date: Wed, 16 Nov 2022 09:59:58 +0000 Subject: [PATCH 2/6] Back out changes to ProjectBuilder --- .../Tests/Xamarin.ProjectTools/Common/Builder.cs | 2 +- .../Tests/Xamarin.ProjectTools/Common/ProjectBuilder.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/Builder.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/Builder.cs index 8b83c2f7b51..5f3d93bce01 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/Builder.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/Builder.cs @@ -47,7 +47,7 @@ public IEnumerable LastBuildOutput { } public TimeSpan LastBuildTime { get; protected set; } public string BuildLogFile { get; set; } - public bool ThrowOnBuildFailure { get; set; } = true; + public bool ThrowOnBuildFailure { get; set; } /// /// True if NuGet restore occurs automatically (default) /// diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/ProjectBuilder.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/ProjectBuilder.cs index 9ad75e4db5c..0d4f1f3fbcb 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/ProjectBuilder.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/ProjectBuilder.cs @@ -14,6 +14,7 @@ public ProjectBuilder (string projectDirectory) { ProjectDirectory = projectDirectory; Target = "Build"; + ThrowOnBuildFailure = true; BuildLogFile = "build.log"; } From b8be51b21db1cd27415cfb2bffd86a5b0b2e2770 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Thu, 17 Nov 2022 13:07:01 +0000 Subject: [PATCH 3/6] Run the _CheckAndroidHttpClientHandlerType just after compile --- .../targets/Microsoft.Android.Sdk.BuildOrder.targets | 4 ++-- .../Tasks/CheckClientHandlerType.cs | 6 ------ .../Xamarin.Android.Common.targets | 5 ++--- .../Xamarin.Android.Legacy.targets | 2 +- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.BuildOrder.targets b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.BuildOrder.targets index 7502dad455e..b9305f91637 100644 --- a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.BuildOrder.targets +++ b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.BuildOrder.targets @@ -28,7 +28,6 @@ projects, these properties are set in Xamarin.Android.Legacy.targets. _CollectJavaSourceForBinding; _CompileBindingJava; $(BuildDependsOn); - _CheckAndroidHttpClientHandlerType; _CompileDex; $(_AfterCompileDex); @@ -136,10 +135,11 @@ projects, these properties are set in Xamarin.Android.Legacy.targets. _IncludeLayoutBindingSources; AddLibraryJarsToBind; $(CompileDependsOn); + _CheckAndroidHttpClientHandlerType; UpdateGeneratedFiles; - $(CoreCompileDependsOn) + $(CoreCompileDependsOn); $(DeferredBuildDependsOn); diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/CheckClientHandlerType.cs b/src/Xamarin.Android.Build.Tasks/Tasks/CheckClientHandlerType.cs index 58d8048abe3..34c12d2bfc9 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/CheckClientHandlerType.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/CheckClientHandlerType.cs @@ -21,8 +21,6 @@ public class CheckClientHandlerType : AndroidTask [Required] public ITaskItem[] ResolvedAssemblies { get; set; } - public bool IsLinkerEnabled { get; set; } - public override bool RunTask () { string[] types = ClientHandlerType.Split (','); @@ -65,10 +63,6 @@ public override bool RunTask () break; } if (handlerType == null) { - if (IsLinkerEnabled) { - Log.LogDebugMessage ("Could not resolve '{type}' from '{assembly}'. It was probably linked out during the build."); - return true; - } Log.LogCodedError ("XA1032", Xamarin.Android.Tasks.Properties.Resources.XA1032, type, assembly); return false; } diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets index 5a149fdce2f..875dc59abe9 100644 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets @@ -490,7 +490,7 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved. + Condition=" '$(AndroidHttpClientHandlerType)' != '' And '$(AndroidApplication)' == 'True' "> System.Net.Http.HttpClientHandler, System.Net.Http System.Net.Http.HttpMessageHandler, System.Net.Http @@ -498,8 +498,7 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved. diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Legacy.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Legacy.targets index 30b10e3b09e..6933effea1b 100644 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Legacy.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Legacy.targets @@ -40,7 +40,6 @@ projects. .NET 5 projects will not import this file. _RemoveLegacyDesigner; _ValidateAndroidPackageProperties; $(BuildDependsOn); - _CheckAndroidHttpClientHandlerType; _CompileDex; $(_AfterCompileDex); $(_PostBuildTargets) @@ -185,6 +184,7 @@ projects. .NET 5 projects will not import this file. _SetupDesignTimeBuildForCompile; AddLibraryJarsToBind; $(CompileDependsOn); + _CheckAndroidHttpClientHandlerType; From a67c526de71545bc334a7dc681b5ddc9bbbbbbc7 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Fri, 18 Nov 2022 11:27:53 +0000 Subject: [PATCH 4/6] Move the _CheckAndroidHttpClientHandlerType --- src/Xamarin.Android.Build.Tasks/Xamarin.Android.Legacy.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Legacy.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Legacy.targets index 6933effea1b..b08a0d94736 100644 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Legacy.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Legacy.targets @@ -94,6 +94,7 @@ projects. .NET 5 projects will not import this file. _AddAndroidDefines; _IncludeLayoutBindingSources; $(CompileDependsOn); + _CheckAndroidHttpClientHandlerType; UpdateGeneratedFiles; @@ -184,7 +185,6 @@ projects. .NET 5 projects will not import this file. _SetupDesignTimeBuildForCompile; AddLibraryJarsToBind; $(CompileDependsOn); - _CheckAndroidHttpClientHandlerType; From 2562dca0510f1d2e3c1c7305ca5b9308df57ce8f Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Tue, 22 Nov 2022 14:07:31 +0000 Subject: [PATCH 5/6] Fix unit test under Legacy --- .../Tasks/CheckClientHandlerTypeTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/CheckClientHandlerTypeTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/CheckClientHandlerTypeTests.cs index c7c49809d6b..b1e385ef7f0 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/CheckClientHandlerTypeTests.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/CheckClientHandlerTypeTests.cs @@ -27,7 +27,7 @@ public void ErrorIsNotRaised (string handler, string validBaseType) var proj = new XamarinAndroidApplicationProject () { IsRelease = false, }; - proj.SetProperty ("AndroidHttpClientHandlerType", handler); + proj.PackageReferences.Add (new Package() { Id = "System.Net.Http", Version = "*" }); using (var b = CreateApkBuilder (path)) { b.ThrowOnBuildFailure = false; b.Build (proj); // we don't care it might error. @@ -64,7 +64,7 @@ public void ErrorIsRaised (string handler, string validBaseType) var proj = new XamarinAndroidApplicationProject () { IsRelease = false, }; - proj.SetProperty ("AndroidHttpClientHandlerType", handler); + proj.PackageReferences.Add (new Package() { Id = "System.Net.Http", Version = "*" }); using (var b = CreateApkBuilder ()) { b.ThrowOnBuildFailure = false; b.Build (proj); From 121eb1c1e102d8c681b39c79cf9591296a297493 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Tue, 22 Nov 2022 16:30:04 +0000 Subject: [PATCH 6/6] Remove System.Net.Http.MonoWebRequestHandler test as it is redundant --- .../Tests/Xamarin.Android.Build.Tests/Tasks/LinkerTests.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/LinkerTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/LinkerTests.cs index dae79f04cfd..eaac7f551c2 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/LinkerTests.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/LinkerTests.cs @@ -180,8 +180,6 @@ public void PreserveCustomHttpClientHandlers () } else { PreserveCustomHttpClientHandler ("Xamarin.Android.Net.AndroidClientHandler", "", "temp/PreserveAndroidHttpClientHandler", "android/assets/Mono.Android.dll"); - PreserveCustomHttpClientHandler ("System.Net.Http.MonoWebRequestHandler", "System.Net.Http", - "temp/PreserveMonoWebRequestHandler", "android/assets/System.Net.Http.dll"); } }