I would like to use an android project in xamarin for example this one: https://github.com/jaydeepw/poly-picker
This project is written in java and has resources and activities.
As far as I understand it is not possible to compile such a project into a jar and then to create a binding library.
Is this correct?
What options do exist to use such a project, apart from porting the source code?
Unfortunately, only you can binding Java libraries, not apps.
You can read this post:
https://developer.xamarin.com/guides/android/advanced_topics/java_integration_overview/binding_a_java_library_(.jar)/
Related
I need to create a Xamarin library that contains few activities and logic. Then I need to import it to the main application and use it. I'm using visual studio for development. Is this possible to do? I have done this in android studio with .aar files but not sure in c#
It is possible.
You only need to create a Xamarin.Android Java Bindings Library from an Android .AAR file.
We'll use the following steps to create a Bindings Library from the .AAR file:
Create a new Java Bindings Library project.
Add a single .AAR file to the project. A binding project may only contain a single .AAR.
Set the appropriate build action for the .AAR file.
Choose a target framework that the .AAR supports.
Build the Bindings Library.
Once we've created the Bindings Library, we can use the Bindings Library in xamarin android project.
More detail info can refer to Binding an .AAR.
I am trying to port cocoapods to xamarin.
Objective C based cocoapods can be ported by converting it into a static library(.a) and subsequently converting that as binding library in xamarin studio or visual studio
But Swift based cocoapods can not be converted into a static library and so it can't be ported to xamarin.
but swift can be converted into a dynamic framework but I couldn't find any way to port that to xamarin
Is there any other way to port swift based cocoapods or ios project into xamarin ?
Binding a Swift Library in Xamarin.iOS follows the same process for Objective-C as shown in xamarin documentation
but with some caveats.
A swift class must inherit from NSObject to be binded.
Swift compiler will translate class and protocol names into something else, so you must specify the final name in the
ApiDefinition.
In runtime your APP must include some swift core libraries alongside your binded framework in a folder called Frameworks;
When the App is pushed to AppStore it must include a SwiftSupport folder alongside your Payload folder. Those are inside the IPA file.
Here you can find a simple sample binding: https://github.com/Flash3001/Xamarin.BindingSwiftLibrarySample
And a full binding sample: https://github.com/Flash3001/iOSCharts.Xamarin
I would like to share common code between a Xamarin.Forms project (C#) and a Qt project (C++).
Have you got a solution?
I try with a Visual C# Class Library which builds a DLL file. I succeeded to reference and use it in the Xamarin.Forms project, but I failed to use it in Qt. I supposed this is because the DLL is compiled from C# code.
Thanks.
If you can put the shared code in your C# dll, you should be able to use it from Xamarin (depending on what libraries it uses) and also call it from your C++ code.
I'm searching to integrate the Fyber SDK into a xamarin.Forms cross-platform app to integrate an OfferWall. The problem is that I do not find any documentation by Xamarin side and by Fyber it only tells me the way is usually done (with Natives SDKs). I already looked for a Binding Library but Still learning how to use them.
¿Is there any other way? ¿Any tips?
Thanks.
I guess the best solution is to create a Binding Library with the OfferWall .jar library
There a link to explain you how to create a Binding Library for android: https://developer.xamarin.com/guides/android/advanced_topics/binding-a-java-library/
And this one for binding a .jar library: https://developer.xamarin.com/guides/android/advanced_topics/binding-a-java-library/binding-a-jar/
I have created a C++ static library for ios (XCode 6.1) in visual studio. But when I compile this project, the output .a file is getting created in Mac machine and not getting copied back to Windows. My concern is that how can I refer this static library in an iOS C# application project in Visual studio?
So you have several options here, what you need to do is to have a Dll that contains the native .a library and the resources/code to interop with the native c++ library (and reference that Dll in your Visual Studio Xamarin.iOS project). You can use a Xamarin iOS Binding project as a container and one of the following options
You can use swig to wrap the c++ lib and there is actually a video from Xamarin University lighting lectures from Chris Van Wyk that describes the process.
You can use Mono CppSharp to wrap the library (My personal favourite easier to use than swig).
You can write your own c wrapper around the c++ library and P/Invoke that from C#
You can write your own Objective-C wrapper around the c++ library and use a Xamarin.iOS Binding project to interop with it.
Hope this helps.