VOOZH about

URL: https://www.nuget.org/packages/XDev.Android.MavenBinding.Tasks

⇱ NuGet Gallery | XDev.Android.MavenBinding.Tasks 0.0.14.1




👁 Image
XDev.Android.MavenBinding.Tasks 0.0.14.1

dotnet add package XDev.Android.MavenBinding.Tasks --version 0.0.14.1
 
 
NuGet\Install-Package XDev.Android.MavenBinding.Tasks -Version 0.0.14.1
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="XDev.Android.MavenBinding.Tasks" Version="0.0.14.1" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XDev.Android.MavenBinding.Tasks" Version="0.0.14.1" />
 
Directory.Packages.props
<PackageReference Include="XDev.Android.MavenBinding.Tasks" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add XDev.Android.MavenBinding.Tasks --version 0.0.14.1
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: XDev.Android.MavenBinding.Tasks, 0.0.14.1"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package XDev.Android.MavenBinding.Tasks@0.0.14.1
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=XDev.Android.MavenBinding.Tasks&version=0.0.14.1
 
Install as a Cake Addin
#tool nuget:?package=XDev.Android.MavenBinding.Tasks&version=0.0.14.1
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Fork info

This package is a fork of the original to add support for multiple native libs (.jar's or .aar's) being supplied by a "roll-up" package and resolved by consuming projects using this forked build-task package. Currently, there is no support for defining multiple native artifacts in a consuming project's <PackageReference> or in <ProjectReference> nodes as discussed/proposed in .Net 9 preview.

See here for discussion on possible inclusion of "roll-up" packages in .Net 9, and express your support/interest.

Extended features in this fork

This fork depends on the NuGet package(s) containing multiple native artifacts to list them in the package Metadata tags separated by ";" like:

	<PackageTags>
		square;moshi;moshi-adapters;java;android;
		artifact=com.squareup.moshi:moshi;artifact_versioned=com.squareup.moshi:moshi:1.15.0;
		artifact=com.squareup.moshi:moshi-adapters;artifact_versioned=com.squareup.moshi:moshi-adapters:1.15.0;
	</PackageTags>

All other original functionality is un-changed in this fork.

If you'd like to extend this fork (like adding support for defining multiple refs in <PackageReference JavaArtifact="">), please contribute!

Notes on usage

  • When adding or updating the XDev.Android.MavenBinding.tasks package, it is recommended to reload the project, and this can be a little slow.

  • Using this package along side the original XamPrototype.Android.MavenBinding.Tasks in a single solution is not supported and behavior is undefined.

  • It is recommended to make this package private (the original too) in the consuming project so that this package does not propagate as a NuGet dependency itself. It is only an optional build-tool, not a runtime dependency, like so:

     <PackageReference Include="XDev.Android.MavenBinding.Tasks" Version="x.y.z" PrivateAssets="All">
     	<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
     </PackageReference>
    

Update

NOTE: Versions of these features have been added to .NET 9 Preview 3 and thus there will not be any future updates to this repository.


Original Content

We are prototyping a new feature for .NET for Android 8 that allows Java libraries to be bound directly from Maven repositories. Additionally, it uses the .pom file provided to ensure that the dependencies needed by the Java library are met.

In order to get early testing and feedback, we are shipping a preview of this as a NuGet package that can be used from .NET 6/7.

Note this is a proposed new .NET for Android 8 feature. There is no guarantee that it will ship in the final .NET 8.

This feature focuses on tackling two pain points of binding from Maven:

  • Acquiring the .jar/.aar and the related .pom from Maven
  • Using the .pom to verify that required Java dependencies are being fulfilled

Getting Started

Create a new .NET Android Bindings library either through the VS "New Project" dialog or the command line:

dotnet new androidlib

Add the XamPrototype.Android.MavenBinding.Tasks NuGet package to the library through VS or the command line:

dotnet add package XamPrototype.Android.MavenBinding.Tasks

Let's take an example: Square's okhttp3 version 4.9.3 available in Maven.

Editor's note: we have an official binding for this library, but for the sake of an example.

Add a new <AndroidMavenLibrary> which specifies the Java artifact we want to bind:


<ItemGroup>
 <AndroidMavenLibrary Include="com.squareup.okhttp3:okhttp" Version="4.9.3" />
</ItemGroup>

Note: By default, this pulls the library from Maven Central. There is also support for Google's Maven, custom Maven repositories, and local Java artifact files. See Advanced MavenDownloadTask Usage for more details.

If you compile the binding now, the library will be automatically downloaded from Maven as well as the associated .pom file. The .pom file details the dependencies needed by this library, and the following build errors will be generated:

error XA0000: Maven dependency 'com.squareup.okio:okio' version '2.8.0' is not satisfied. Microsoft maintains the NuGet package 'Square.OkIO' that could fulfill this dependency.
error XA0000: Maven dependency 'org.jetbrains.kotlin:kotlin-stdlib' version '1.4.10' is not satisfied. Microsoft maintains the NuGet package 'Xamarin.Kotlin.StdLib' that could fulfill this dependency.

These are both libraries that Microsoft provides official NuGet bindings for, so we can add those NuGet packages:

dotnet add package Xamarin.Kotlin.StdLib
dotnet add package Square.OkIO

Note: Not all dependencies will have official NuGet bindings. For other examples of ways to fulfill dependencies, see Advanced MavenDependencyVerifierTask Scenarios.

Note: We still need to get the required metadata into all of our packaged bindings. If you still get resolution errors then we haven't added it to these packages. You will need to add the following attributes as described in see Advanced MavenDependencyVerifierTask Scenarios. In the future it will work automagically.

<PackageReference Include="Square.OkIO" Version="2.10.0.5" JavaArtifact="com.squareup.okio:okio" JavaVersion="2.10.0" />
<PackageReference Include="Xamarin.Kotlin.StdLib" Version="1.7.10" JavaArtifact="org.jetbrains.kotlin:kotlin-stdlib" JavaVersion="1.7.10" />

Now if you try to compile the library the dependencies will be detected as fulfilled, and the build continues. If you get C# compile errors (like with this package) you are now back to the normal binding process. (ie: fixing with Metadata).

Known Limitations

  • Several of Microsoft's published NuGet bindings are missing needed metadata for automatic dependency resolution. Will be audited and fixed. (Workaround)

Feedback

If you give this a try, we'd love to hear your feedback! Did it work? Are there any additional scenarios that we should explore covering?

Please use the Discussions tab on this GitHub repo for feedback, or the Issues tab for bugs.

Product Versions Compatible and additional computed target framework versions.
.NET net5.0 net5.0 was computed.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 was computed.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 was computed.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
.NET Core netcoreapp2.0 netcoreapp2.0 was computed.  netcoreapp2.1 netcoreapp2.1 was computed.  netcoreapp2.2 netcoreapp2.2 was computed.  netcoreapp3.0 netcoreapp3.0 was computed.  netcoreapp3.1 netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 netstandard2.0 is compatible.  netstandard2.1 netstandard2.1 was computed. 
.NET Framework net461 net461 was computed.  net462 net462 was computed.  net463 net463 was computed.  net47 net47 was computed.  net471 net471 was computed.  net472 net472 was computed.  net48 net48 was computed.  net481 net481 was computed. 
MonoAndroid monoandroid monoandroid was computed. 
MonoMac monomac monomac was computed. 
MonoTouch monotouch monotouch was computed. 
Tizen tizen40 tizen40 was computed.  tizen60 tizen60 was computed. 
Xamarin.iOS xamarinios xamarinios was computed. 
Xamarin.Mac xamarinmac xamarinmac was computed. 
Xamarin.TVOS xamarintvos xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.14.1 675 6/17/2024
0.0.13.2 229 6/13/2024
0.0.13.1 203 6/12/2024

- Extending support of original package to support "roll-up" packages when artifacts listed in package tags (meta-data).
     - Updated dependencies that have vulnerabilities.
     - Removed some debug output in build logs
     - Fixed issue where IgnoredMavenDependency tag was not respected. https://xdevapps.visualstudio.com/Android bindings/_boards/board/t/Android bindings Team/Issues?workitem=129