Importing Java JAR files and Java APIs into shared items library

JohnCTX 636 Reputation points
2021-01-08T16:34:56.213+00:00

I want users to provide me some examples on how to import Java API references and JAR files into Xamarin Shared Items project.

I know this can be done.

Afterwards I would need to use that library from the shared items project, and import it to a cross-platform iOS/Android project.

Also, I need to know if it is possible to use Java programming language API, and import it to a cross-platform iOS/Android mobile project.

Can this be done?

Regards,

JohnCTX

Developer technologies | .NET | Xamarin
0 comments No comments
{count} votes

Accepted answer
  1. JessieZhang-MSFT 7,716 Reputation points Microsoft External Staff
    2021-01-11T08:42:39.667+00:00

    Hello,

    Welcome to our Microsoft Q&A platform!

    Do you want this: https://learn.microsoft.com/en-us/xamarin/android/platform/binding-java-library/binding-a-jar ?

    And if you want to use native api in form, you can use DependencyService to achieve this.

    The DependencyService class is a service locator that enables Xamarin.Forms applications to invoke native platform functionality from shared code.

    For more details, you can check: https://learn.microsoft.com/en-us/dotnet/api/xamarin.forms.dependencyservice?view=xamarin-forms

    Best Regards,

    Jessie Zhang


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.