diff --git a/Documentation/guides/JavaDependencyVerification.md b/Documentation/guides/JavaDependencyVerification.md index 55090729227..6607a3d25b4 100644 --- a/Documentation/guides/JavaDependencyVerification.md +++ b/Documentation/guides/JavaDependencyVerification.md @@ -90,11 +90,10 @@ Additionally, a POM file can "import" dependency information from another POM fi ``` -Dependency information cannot be accurately determined without also having access to these additional POM files, and will results in errors like: +Dependency information cannot be accurately determined without also having access to these additional POM files, and will results in an error like: ``` error : Unable to resolve POM for artifact 'com.squareup.okio:okio-parent:1.17.4'. -error : Could not verify Java dependencies for artifact 'com.squareup.okio:okio:1.17.4' due to missing POM files. See other error(s) for details. ``` In this case, we need to provide the POM file for `com.squareup.okio:okio-parent:1.17.4`: diff --git a/Documentation/guides/messages/xa4234.md b/Documentation/guides/messages/xa4234.md new file mode 100644 index 00000000000..acb67c440fa --- /dev/null +++ b/Documentation/guides/messages/xa4234.md @@ -0,0 +1,34 @@ +--- +title: .NET Android error XA4234 +description: XA4234 error code +ms.date: 02/26/2024 +--- +# .NET Android error XA4234 + +## Example message + +``` +error XA4234: '' item 'com.example:mylib' is missing required attribute 'Version'. +``` + +## Issue + +The specified MSBuild XML item requires the specified XML attribute. + +For example the following item is missing the required 'Version' attribute: + +```xml + + + +``` + +## Solution + +To resolve this error, ensure that the specified XML contains the specified attribute: + +```xml + + + +``` diff --git a/Documentation/guides/messages/xa4235.md b/Documentation/guides/messages/xa4235.md new file mode 100644 index 00000000000..256115b42ce --- /dev/null +++ b/Documentation/guides/messages/xa4235.md @@ -0,0 +1,34 @@ +--- +title: .NET Android error XA4235 +description: XA4235 error code +ms.date: 02/26/2024 +--- +# .NET Android error XA4235 + +## Example message + +``` +error XA4235: Maven artifact specification 'com.example' is invalid. The correct format is 'group_id:artifact_id'. +``` + +## Issue + +The specified Maven artifact specification is invalid. + +For example the following item uses a comma separator instead of a colon: + +```xml + + + +``` + +## Solution + +To resolve this error, ensure that the artifact specification is of the form 'group_id:artifact_id': + +```xml + + + +``` diff --git a/Documentation/guides/messages/xa4236.md b/Documentation/guides/messages/xa4236.md new file mode 100644 index 00000000000..ba352dae46a --- /dev/null +++ b/Documentation/guides/messages/xa4236.md @@ -0,0 +1,37 @@ +--- +title: .NET Android error XA4236 +description: XA4236 error code +ms.date: 02/26/2024 +--- +# .NET Android error XA4236 + +## Example message + +``` +error XA4236: Cannot download Maven artifact 'com.example:mylib'. +error XA4236: - mylib-1.0.0.jar: Response status code does not indicate success: 404 (Not Found). +error XA4236: - mylib-1.0.0.aar: Response status code does not indicate success: 404 (Not Found). +``` + +## Issue + +Errors were encountered while trying to download the requested Java library from Maven. + +For example the following item doesn't actually exist on Maven Central, resulting in "Not Found": + +```xml + + + +``` + +## Solution + +Resolving this error depends on the error message specified. + +It could be things like: +- Check your internet connection. +- Ensure you have specified the correct group id and artifact id. +- Ensure you have specified the correct Maven repository. + +Additional documentation about configuring `` is available [here](../AndroidMavenLibrary.md). diff --git a/Documentation/guides/messages/xa4237.md b/Documentation/guides/messages/xa4237.md new file mode 100644 index 00000000000..d02c16d8481 --- /dev/null +++ b/Documentation/guides/messages/xa4237.md @@ -0,0 +1,24 @@ +--- +title: .NET Android error XA4237 +description: XA4237 error code +ms.date: 02/26/2024 +--- +# .NET Android error XA4237 + +## Example message + +``` +error XA4237: Cannot download POM file for Maven artifact 'com.example:mylib':1.0.0. +error XA4237: - mylib-1.0.0.pom: Response status code does not indicate success: 404 (Not Found). +``` + +## Issue + +An error was encountered while trying to download the requested POM file from Maven. + +## Solution + +Resolving this error depends on the error message specified. + +It could be things like: +- Check your internet connection. diff --git a/Documentation/guides/messages/xa4239.md b/Documentation/guides/messages/xa4239.md new file mode 100644 index 00000000000..dfc49124f7e --- /dev/null +++ b/Documentation/guides/messages/xa4239.md @@ -0,0 +1,34 @@ +--- +title: .NET Android error XA4239 +description: XA4239 error code +ms.date: 02/26/2024 +--- +# .NET Android error XA4239 + +## Example message + +``` +error XA4239: Unknown Maven repository: 'example.com'. +``` + +## Issue + +The specified Maven repository is invalid. + +For example the following Maven repository must be specified with `https://`: + +```xml + + + +``` + +## Solution + +To resolve this error, ensure that the Maven repository follows the [documented values](../AndroidMavenLibrary.md): + +```xml + + + +``` diff --git a/Documentation/guides/messages/xa4241.md b/Documentation/guides/messages/xa4241.md new file mode 100644 index 00000000000..8b2efb91dfb --- /dev/null +++ b/Documentation/guides/messages/xa4241.md @@ -0,0 +1,22 @@ +--- +title: .NET Android error XA4241 +description: XA4241 error code +ms.date: 02/26/2024 +--- +# .NET Android error XA4241 + +## Example message + +``` +error XA4241: Java dependency 'org.jetbrains.kotlin:kotlin-stdlib:1.9.0' is not satisfied. +``` + +## Issue + +The specified Java dependency could not be verified using the [Java Dependency Verification](../JavaDependencyVerification.md) +feature. + +## Solution + +To resolve this error, follow the available options in the [Resolving Java Dependencies](../ResolvingJavaDependencies.md) +documentation. diff --git a/Documentation/guides/messages/xa4242.md b/Documentation/guides/messages/xa4242.md new file mode 100644 index 00000000000..f3c6b0a2e7e --- /dev/null +++ b/Documentation/guides/messages/xa4242.md @@ -0,0 +1,27 @@ +--- +title: .NET Android error XA4242 +description: XA4242 error code +ms.date: 02/26/2024 +--- +# .NET Android error XA4242 + +## Example message + +Java dependency '{0}' is not satisfied. Microsoft maintains the NuGet package '{1}' that could fulfill this dependency. + +``` +error XA4242: Java dependency 'org.jetbrains.kotlin:kotlin-stdlib:1.9.0' is not satisfied. +Microsoft maintains the NuGet package 'Xamarin.Kotlin.StdLib' that could fulfill this dependency. +``` + +## Issue + +The specified Java dependency could not be verified using the [Java Dependency Verification](../JavaDependencyVerification.md) +feature. + +## Solution + +Add a reference to the specified NuGet package to the project. + +Alternatively, choose one of the other available options in the [Resolving Java Dependencies](../ResolvingJavaDependencies.md) +documentation. diff --git a/Documentation/guides/messages/xa4243.md b/Documentation/guides/messages/xa4243.md new file mode 100644 index 00000000000..02e26b882a5 --- /dev/null +++ b/Documentation/guides/messages/xa4243.md @@ -0,0 +1,36 @@ +--- +title: .NET Android error XA4243 +description: XA4243 error code +ms.date: 02/26/2024 +--- +# .NET Android error XA4243 + +## Example message + +``` +error XA4243: Attribute 'JavaVersion' is required when using 'JavaArtifact' for 'ProjectReference' item '../ReferenceProject.csproj'. +``` + +## Issue + +The referenced MSBuild item XML specifies an attribute that makes an additional attribute required. + +For example, using the `JavaArtifact` attribute on a `` requires `JavaVersion` to also be specified. + +Invalid: + +```xml + + + +``` + +## Solution + +To resolve this error, specify the required XML attribute: + +```xml + + + +``` diff --git a/Documentation/guides/messages/xa4244.md b/Documentation/guides/messages/xa4244.md new file mode 100644 index 00000000000..016a1d72d80 --- /dev/null +++ b/Documentation/guides/messages/xa4244.md @@ -0,0 +1,36 @@ +--- +title: .NET Android error XA4244 +description: XA4244 error code +ms.date: 02/26/2024 +--- +# .NET Android error XA4244 + +## Example message + +``` +error XA4244: Attribute 'JavaVersion' cannot be empty for 'ProjectReference' item '../ReferenceProject.csproj'. +``` + +## Issue + +The referenced MSBuild item XML specifies a required attribute but omits a required value. + +For example, the `JavaArtifact` attribute on a `` cannot have an empty value. + +Invalid: + +```xml + + + +``` + +## Solution + +To resolve this error, specify a value for the required XML attribute: + +```xml + + + +``` diff --git a/Documentation/guides/messages/xa4245.md b/Documentation/guides/messages/xa4245.md new file mode 100644 index 00000000000..7d72a3c6017 --- /dev/null +++ b/Documentation/guides/messages/xa4245.md @@ -0,0 +1,32 @@ +--- +title: .NET Android error XA4245 +description: XA4245 error code +ms.date: 02/26/2024 +--- +# .NET Android error XA4245 + +## Example message + +``` +error XA4245: Specified POM file 'mylib.pom' does not exist. +``` + +## Issue + +The referenced MSBuild item XML specifies a POM file that cannot be found. + +```xml + + + +``` + +```xml + + + +``` + +## Solution + +To resolve this error, ensure the requested POM file exists in the specified location. diff --git a/Documentation/guides/messages/xa4246.md b/Documentation/guides/messages/xa4246.md new file mode 100644 index 00000000000..ce118c42ea5 --- /dev/null +++ b/Documentation/guides/messages/xa4246.md @@ -0,0 +1,21 @@ +--- +title: .NET Android error XA4246 +description: XA4246 error code +ms.date: 02/26/2024 +--- +# .NET Android error XA4246 + +## Example message + +``` +error XA4246: Could not parse POM file 'mylib.pom'. +error XA4246: - There is an error in XML document (1, 1). +``` + +## Issue + +The referenced POM file cannot be parsed. + +## Solution + +To resolve this error, ensure the requested POM file is valid XML. diff --git a/Documentation/guides/messages/xa4247.md b/Documentation/guides/messages/xa4247.md new file mode 100644 index 00000000000..0e86ad7326c --- /dev/null +++ b/Documentation/guides/messages/xa4247.md @@ -0,0 +1,22 @@ +--- +title: .NET Android error XA4247 +description: XA4247 error code +ms.date: 02/26/2024 +--- +# .NET Android error XA4247 + +## Example message + +``` +error XA4247: Could not resolve POM file for artifact 'com.example:mylib-parent:1.0.0'. +``` + +## Issue + +The specified POM file is needed to complete Java dependency verification, but it could +not be found. This may be due to a missing parent or imported POM file. + +## Solution + +For solutions for fixing this error, refer to the "Additional POM Files" section of the +[Java Dependency Verification](../JavaDependencyVerification.md) documentation. diff --git a/Documentation/guides/messages/xa4248.md b/Documentation/guides/messages/xa4248.md new file mode 100644 index 00000000000..a6508b777cf --- /dev/null +++ b/Documentation/guides/messages/xa4248.md @@ -0,0 +1,21 @@ +--- +title: .NET Android error XA4248 +description: XA4248 error code +ms.date: 02/26/2024 +--- +# .NET Android error XA4248 + +## Example message + +``` +error XA4248: Could not find NuGet package 'Xamarin.Kotlin.StdLib' version '1.9.0' in lock file. Ensure NuGet Restore has run since this was added. +``` + +## Issue + +The NuGet lock file has not been generated and thus Java dependencies from NuGet packages +cannot be resolved. + +## Solution + +Run NuGet Restore for the project to ensure the lock file has been generated. diff --git a/src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs b/src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs index 8a1b45b01c2..dad7d3690f6 100644 --- a/src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs +++ b/src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs @@ -839,6 +839,15 @@ public static string XA1037 { } } + /// + /// Looks up a localized string similar to The Android Support libraries are not supported in .NET 9 and later, please migrate to AndroidX. See https://aka.ms/xamarin/androidx for more details.. + /// + public static string XA1039 { + get { + return ResourceManager.GetString("XA1039", 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 .NET Android once .NET 6 is released.. /// @@ -1209,7 +1218,7 @@ public static string XA4233 { } /// - /// Looks up a localized string similar to '<{0}>' item '{1}' is missing required metadata '{2}'. + /// Looks up a localized string similar to '<{0}>' item '{1}' is missing required attribute '{2}'.. /// public static string XA4234 { get { @@ -1247,16 +1256,6 @@ public static string XA4237 { } } - /// - /// Looks up a localized string similar to Cannot download parent POM file for Maven artifact '{0}:{1}'. - ///- {2}: {3}. - /// - public static string XA4238 { - get { - return ResourceManager.GetString("XA4238", resourceCulture); - } - } - /// /// Looks up a localized string similar to Unknown Maven repository: '{0}'.. /// @@ -1266,15 +1265,6 @@ public static string XA4239 { } } - /// - /// Looks up a localized string similar to Could not verify Java dependencies for artifact '{0}' due to missing POM file(s). See other error(s) for details.. - /// - public static string XA4240 { - get { - return ResourceManager.GetString("XA4240", resourceCulture); - } - } - /// /// Looks up a localized string similar to Java dependency '{0}' is not satisfied.. /// @@ -1321,7 +1311,8 @@ public static string XA4245 { } /// - /// Looks up a localized string similar to Could not parse POM file '{0}': '{1}'.. + /// Looks up a localized string similar to Could not parse POM file '{0}'. + ///- {1}. /// public static string XA4246 { get { diff --git a/src/Xamarin.Android.Build.Tasks/Properties/Resources.resx b/src/Xamarin.Android.Build.Tasks/Properties/Resources.resx index 8828712f2de..c20f355b068 100644 --- a/src/Xamarin.Android.Build.Tasks/Properties/Resources.resx +++ b/src/Xamarin.Android.Build.Tasks/Properties/Resources.resx @@ -954,7 +954,7 @@ To use a custom JDK path for a command line build, set the 'JavaSdkDirectory' MS - '<{0}>' item '{1}' is missing required metadata '{2}' + '<{0}>' item '{1}' is missing required attribute '{2}'. {0} - The MSBuild ItemGroup Item name {1} - The MSBuild Item ItemSpec {2} - The omitted MSBuild Item metadata attribute @@ -983,15 +983,6 @@ To use a custom JDK path for a command line build, set the 'JavaSdkDirectory' MS {0} - Maven artifact id {1} - The HttpClient reported download exception message - - - Cannot download parent POM file for Maven artifact '{0}:{1}'. -- {2}: {3} - The following are literal names and should not be translated: POM, Maven -{0} - Maven artifact group id -{1} - Maven artifact id -{2} - The .pom filename we tried to download -{3} - The HttpClient reported download exception message Unknown Maven repository: '{0}'. @@ -1008,11 +999,6 @@ To use a custom JDK path for a command line build, set the 'JavaSdkDirectory' MS The Android Support libraries are not supported in .NET 9 and later, please migrate to AndroidX. See https://aka.ms/xamarin/androidx for more details. The following are literal names and should not be translated: Android Support, AndroidX, .NET. - - Could not verify Java dependencies for artifact '{0}' due to missing POM file(s). See other error(s) for details. - The following are literal names and should not be translated: Java, POM. -{0} - Maven artifact id - Java dependency '{0}' is not satisfied. The following are literal names and should not be translated: Java. @@ -1042,7 +1028,8 @@ To use a custom JDK path for a command line build, set the 'JavaSdkDirectory' MS {0} - File path to POM file - Could not parse POM file '{0}': '{1}'. + Could not parse POM file '{0}'. +- {1} The following are literal names and should not be translated: POM. {0} - File path to POM file {1} - Exception message diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/JavaDependencyVerification.cs b/src/Xamarin.Android.Build.Tasks/Tasks/JavaDependencyVerification.cs index 1aaa6819335..2549ba7548f 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/JavaDependencyVerification.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/JavaDependencyVerification.cs @@ -89,8 +89,6 @@ public override bool RunTask () if (TryResolveProject (pom, pom_resolver, out var resolved_pom)) { foreach (var dependency in resolved_pom.Dependencies.Where (d => (d.IsRuntimeDependency () || d.IsCompileDependency ()) && !d.IsOptional ())) resolver.EnsureDependencySatisfied (dependency, ms_packages); - } else { - Log.LogCodedError ("XA4240", Properties.Resources.XA4240, pom); } } diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/MavenDownloadTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/MavenDownloadTests.cs index 9fa10ea2da8..c2ad0117fe4 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/MavenDownloadTests.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/MavenDownloadTests.cs @@ -24,7 +24,7 @@ public async Task MissingVersionMetadata () await task.RunTaskAsync (); Assert.AreEqual (1, engine.Errors.Count); - Assert.AreEqual ("'' item 'com.google.android.material:material' is missing required metadata 'Version'", engine.Errors [0].Message); + Assert.AreEqual ("'' item 'com.google.android.material:material' is missing required attribute 'Version'.", engine.Errors [0].Message); } [Test]