Hi there
I have an AAR binary which I have to include into my Xamarin Forms (Droid part) project. The How-To document accompanying the AAR reads about different environment: Android Studio and the File - New - Module path.
How to include a reference to it in Xamarin project?
Thanks.
Posts
Well, the solution is found:
https://developer.xamarin.com/guides/android/advanced_topics/binding-a-java-library/binding-an-aar/
But. It exports only a couple of interfaces while the SDK How-to document reads about tons of classes and methods. Is there any chance that I did something wrong while exporting the aar? Any clue how to verify it?
Thanks.
@NickRenzhiglov you must also add dependency aar / jar files.
Hi BerayBentesen
Any links on how to add dependency? The Xamarin How-to document mentions nothing about it.
Thanks.
@NickRenzhiglov it depends on jar/aar file that you want to bind. For example in Glide, I had to add Support v4 library additionally. I checked Github code for that library and maybe you can check too.
E.g.
I've downloaded two jar file and made some modification in Metadata file to fix error.
Hope this help.
BerayBentesen.
I opened a project in Android Studio, loaded a .aar. In shows me
no dependencies
for it in Project Structure | Dependencies.
I imported everything I need in my java code and I can see all classes are available for me. To make it exact:
import ...
import com.android.biomini.BioMiniAndroid; //<- this is from aar
import com.android.biomini.IBioMiniCallback; //<- this is from aar
public class MainActivity extends AppCompatActivity {
private static BioMiniAndroid mBioMiniHandle; //<- I can declare the instance of the .aar class which is not visible when I bind and create a reference to .dll in my Xamarin project
... }
}
What else the reason it can be?
Thanks.
@NickRenzhiglov
For example:
Check here for detailed info.
It seems like it is the way to go. Any clue on where that Metadata.xml file resides? It is not clear from the link you provided.
Thanks.
Oh, I found its location, it is Transforms folder. Thanks.
@NickRenzhiglov You're welcome
Ok. I did both modifications like this:
public
false
to my Metadata.xml. The Binding project builds fine, but the reference to it still has no classes visible. Problem is not fixed.
Any clue on where to dig?
Thanks.
Well, my post above has no quoted xml markup. Those "public false" should read as attached
Hi BerayBentesen.
I managed to disassemble my .aar file. The class, which makes me troubles, is declared as public. So the accessibility is not a source of the issue.
As per its imports, there are about 15 declaration and top 2 of them are, lets say,
import android.app.Activity;
import android.hardware.usb;
Could you explain (you did it earlier, thanks, but please be more detailed) what has to be done to make sure I have this part available while building the Binding project?
Thanks.
Hi Nick.
Here is how I managed to bind biomini aar
1) Created an Android binding project
2) Add biomini aar under jars folder
3) Change Build Action to LibraryProjectZip
Hope this helps
Did anyone manage to successfully bind to biomini aar ? My specific issue is "Invalidating Com.Suprema.IBioMiniDevice and all nested types because some of its methods were invalid."
Hi, one question. Did you find a solution?
has anyone managed to solve the problem? I am in the same situation as importing the aar, not being able to map the IBioMiniDevice interface
1>BINDINGSGENERATOR : warning BG8800: Unknown parameter type com.suprema.d in method CaptureAuto in managed type Com.Suprema.IBioMiniDevice.
1>BINDINGSGENERATOR : warning BG8800: Unknown parameter type com.suprema.d in method CaptureSingle in managed type Com.Suprema.IBioMiniDevice.
1>BINDINGSGENERATOR : warning BG8800: Unknown parameter type com.suprema.d in method StartCapturing in managed type Com.Suprema.IBioMiniDevice.
1>BINDINGSGENERATOR : warning BG8503: Invalidating Com.Suprema.IBioMiniDevice and all nested types because some of its methods were invalid.
1>BINDINGSGENERATOR : warning BG8701: Invalid return type com.suprema.IBioMiniDevice in managed type Com.Suprema.BioMiniFactory.
1>BINDINGSGENERATOR : warning BG8C00: For type Com.Suprema.CaptureResponder, base interface com.suprema.d does not exist.
1>BINDINGSGENERATOR : warning BG8C00: For type Com.Suprema.Usb.UsbHandlerAndroid, base interface com.suprema.usb.a does not exist.
1>BINDINGSGENERATOR : warning BG8800: Unknown parameter type com.suprema.usb.a.a in method A in managed type Com.Suprema.Usb.UsbHandlerAndroid.
1>BINDINGSGENERATOR : warning BG8800: Unknown parameter type com.suprema.usb.a.b in method A in managed type Com.Suprema.Usb.UsbHandlerAndroid.
1>BINDINGSGENERATOR : warning BG8800: Unknown parameter type com.suprema.usb.a.b in method A in managed type Com.Suprema.Usb.UsbHandlerAndroid.
1>BINDINGSGENERATOR : warning BG8800: Unknown parameter type com.suprema.b.c in method A in managed type Com.Suprema.Usb.UsbHandlerAndroid.
1>BINDINGSGENERATOR : warning BG8800: Unknown parameter type com.suprema.b.c in method A in managed type Com.Suprema.Usb.UsbHandlerAndroid.
1>BINDINGSGENERATOR : warning BG8800: Unknown parameter type com.suprema.b.c in method A in managed type Com.Suprema.Usb.UsbHandlerAndroid.
1>BINDINGSGENERATOR : warning BG8800: Unknown parameter type com.suprema.usb.a.b in method B in managed type Com.Suprema.Usb.UsbHandlerAndroid.
1>BINDINGSGENERATOR : warning BG8800: Unknown parameter type com.suprema.b.c in method B in managed type Com.Suprema.Usb.UsbHandlerAndroid.
1>BINDINGSGENERATOR : warning BG8800: Unknown parameter type com.suprema.usb.a.b in method C in managed type Com.Suprema.Usb.UsbHandlerAndroid.
1>BINDINGSGENERATOR : warning BG8801: Invalid parameter type com.suprema.IBioMiniDevice.TransferMode in method SetTransferMode in managed type Com.Suprema.BioMiniFactory.
1>BINDINGSGENERATOR : warning BG8C00: For type Com.Suprema.CaptureResponder, base interface com.suprema.d does not exist.
1>BINDINGSGENERATOR : warning BG8801: Invalid parameter type com.suprema.IBioMiniDevice.FingerState in method OnCapture in managed type Com.Suprema.CaptureResponder.
1>BINDINGSGENERATOR : warning BG8801: Invalid parameter type com.suprema.IBioMiniDevice.TemplateData in method OnCaptureEx in managed type Com.Suprema.CaptureResponder.
1>BINDINGSGENERATOR : warning BG8C00: For type Com.Suprema.Usb.UsbHandlerAndroid, base interface com.suprema.usb.a does not exist.