magnusja / libaums

Open source library to access USB Mass Storage devices on Android without rooting your device
Apache License 2.0
1.26k stars 270 forks source link

GettingMissing permission to access usb device . #398

Closed nnitesh786 closed 9 months ago

nnitesh786 commented 11 months ago

Hi ,

I ma trying to initilize the usb device but i am getting below Exception .

07-14 21:05:48.228 10322 10322 E AndroidRuntime: FATAL EXCEPTION: main 07-14 21:05:48.228 10322 10322 E AndroidRuntime: Process: com.example.myusbmanager, PID: 10322 07-14 21:05:48.228 10322 10322 E AndroidRuntime: java.lang.IllegalStateException: Missing permission to access usb device: UsbDevice[mName=/dev/bus/usb/001/012,mVendorId=1921,mProductId=21863,

I am calling like this to get the file system partition .

           try {
               device.init();
           } catch (IOException e) {
               Log.e(TAG, "exception: " + e);
           }

FileSystem mCurrenntFs = device.getPartitions().get(0).getFileSystem();

Please help me how to solve this issue.

magnusja commented 9 months ago

The log even says that you are missing permission to access the usb device. You have to request permission from the user first. This is described in the readme. For further reference please consult the official Android docs