dotnet / android

.NET for Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#
MIT License
1.92k stars 525 forks source link

Getting multiple issues when adding .aar file in android binding library. #9056

Closed SuvarnaKr closed 1 month ago

SuvarnaKr commented 3 months ago

Description

I am trying to integrate the native android application .net maui. For this i have created a android binding library and adding .aar file to this project. But this is giving multiple build errors like method already defined, method is not implemented. To resolve these i modified metadata.xml file as provided in the documentation. As a result build errors are removed but the classes and methods are not exposed so its available for maui application when android binding library is added as .dll reference. Kindly help me to resolve this issues with all the methods available to .net maui app.

Steps to Reproduce

  1. Create a maui application.
  2. Go to file -> new project -> Android binding library ->create
  3. Right click on android binding library -> add existing file->select .aar file for android library->add
  4. Try to build only android binding library.
  5. Build is failed with errors.

Link to public reproduction project repository

No response

Version with bug

8.0.20 SR4

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

Unknown/Other

Affected platforms

I was not able test on other platforms

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

drasticactions commented 3 months ago

@SuvarnaKr As far as I know, the binding tooling exists inside this repo. However, reading your issue, I don't believe there's anything specific about this that would be driven by the MAUI UI toolkit tooling, so I've moved it to the Android repo.

If others on this team feel different, or if I missed something, feel free to push it back.

jpobst commented 3 months ago

Here is our documentation for resolving issues with binding libraries: https://github.com/dotnet/java-interop/wiki/Troubleshooting-Android-Bindings-Issues

What types/methods will be available to your MAUI project depends on what steps you took to resolve the errors. For example, if you use <remove-node> to fix an error, you are telling the binding tooling not to create a C# representation of that API.