问题
How can I use a .dll generated with Android Binding (.jar) from Xamarin Forms?
For example in this Picasso android binding, I can successfully use the .dll in Xamarin.Android, but i do not know how to use it in Xamarin Forms.
回答1:
You cannot do that!
Xamarin.Forms Bindings (.dll) and Xamarin.Android Bindings (.dll) do have the same extensions but they are not compatible with each other. Because your Xamarin.Forms project (PCL,.NetStandard or Shared Project) and your Xamarin.Android (Android Native) project are not the same and a .dll like any other extension is made for a particular target audience, in this case, the Picasso.dll you make can never target Xamarin.Forms directly.
What you can do is create a custom renderer that can use these native libraries in respective Android and iOS project. But making those renderer's will be a pain in themselves.
Solution
The Xamarin community in the current times is quite strong there are a lot of libraries available online which you can use to do what Picasso for example does.
There is an excellent Xamarin.Forms library that does what Picasso is used for, FFImageLoading by daniel-luberda.
The library is widely used by the community and is free and can be downloaded on NuGet.
It is well documented and well maintained by the author so there are no worries when it comes to library maintenance.
I hope this helps you with/solves your query.
In case of questions feel free to revert.
来源:https://stackoverflow.com/questions/53496888/xamarin-forms-with-android-binding-jar