Skip to content

Adding .aar and .jar dependencies without C# bindings in Android Java Library Binding Project #8190

@bbarc

Description

@bbarc

Android application type

.NET Android (net7.0-android, etc.)

Affected platform version

Visual Studio Professional 2022 - 17.6.4 on Windows

Description

I have attached the sample code below:

FooBazBar.Client2.zip

In this project I have the FooForBinding-release.aar file intended for binding, however it depends on 3 other java/kotlin libraries which must not get C# bindings. I have achieved this by setting the following elements in .csproj and Metadata.xml:

  • <remove-node path="/api/package[starts-with(@name,'com.example.foononbinding')]" />
  • <AndroidLibrary Update="ReferencedBarK.jar" Bind="false" />
  • <AndroidLibrary Update="ReferencedBazJ.jar" Bind="false" />

My other approaches failed.

The existing documentation helped me a bit, but did not cover the whole process. Moreover, I am not sure if that is the intended way of doing it.

Should there be any other working and documented solution for this type of tasks?

Steps to Reproduce

  1. Just run the attached Android Application without any exceptions being thrown.

Did you find any workaround?

I am not sure if my solution is a workaround or there should be any better approach.

Relevant log output

No response

Metadata

Metadata

Labels

Area: App+Library BuildIssues when building Library projects or Application projects.need-attentionA xamarin-android contributor needs to review

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions