Forum Xamarin.Android


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Binding libaums

alberto.palberto.p ITMember ✭✭

Someone has already tried to do bind libaums library ?



  • ebesnardebesnard FRMember ✭✭

    Did you get it to work?

    I am trying to do the same but I am having this issue :

  • alberto.palberto.p ITMember ✭✭
    edited October 2017

    @ebesnard try to add these into Metadata file:

    <attr path="/api/package[@name='com.github.mjdev.libaums.fs.fat32']/class[@name='FatDirectory']/method[@name='createDirectory' and count(parameter)=1 and parameter[1][@type='java.lang.String']]" name="managedReturn">Com.Github.Mjdev.Libaums.FS.IUsbFile</attr> <attr path="/api/package[@name='com.github.mjdev.libaums.fs.fat32']/class[@name='FatDirectory']/method[@name='createFile']" name="managedReturn">Com.Github.Mjdev.Libaums.FS.IUsbFile</attr>

  • ebesnardebesnard FRMember ✭✭

    Yes I did that but I am having an exception while querying currentFs.Capacity in the below code :

            UsbMassStorageDevice[] devices = UsbMassStorageDevice.GetMassStorageDevices(Global.MyActivity.ApplicationContext);
            foreach (UsbMassStorageDevice device in devices)
                // before interacting with a device you need to call init()!
                // Only uses the first partition on the device
                IFileSystem currentFs = device.Partitions[0].FileSystem;
                Console.WriteLine("Capacity: " + currentFs.Capacity);
                Console.WriteLine("Occupied Space: " + currentFs.OccupiedSpace);
                Console.WriteLine("Free Space: " + currentFs.FreeSpace);
                Console.WriteLine("Chunk size: " + currentFs.ChunkSize);
  • ebesnardebesnard FRMember ✭✭
  • alberto.palberto.p ITMember ✭✭


  • ebesnardebesnard FRMember ✭✭

    And where did you get the AAR? I cannot find it on the web. Could you please share it?

  • ebesnardebesnard FRMember ✭✭

    Also, I am using Visual Studio 2015, and you?
    Would be great if you could share your 0.5.2 AAR cause I still can't find it on the web.

  • ebesnardebesnard FRMember ✭✭

    Thanks but I built the 0.5.2 AAR under Android Studio 2.3.3, then I did bind the AAR under an Android Binding Library project under Visual Studio 2015 but I am still facing the same exception.

    Do you have an example of a code that works for you when you call the binding library?

  • ebesnardebesnard FRMember ✭✭

    Though I am new to Java I did some modifications to the libaums source code and I got it to work. I am now able to list the content of the root directory of a USB stick, create a foler and a text file Inside that folder.
    But sadly every call to UsBMassStorage.Init() has a bad interaction with my app as it ends in a crash after the several operations on the USB stick.

  • ebesnardebesnard FRMember ✭✭

    I finally found why UsbMassStorage.Init() had a bad interaction with the rest of my code, it wasn't due to the libaums Library.

  • danielhuynhdanielhuynh Member

    @ebesnard , I also have problem on UsbMassStorage.Init() and it crash my app. Could you please tell me know where the problem is?

Sign In or Register to comment.