question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read all files from USB drive

See original GitHub issue

Problem

Not all files are returned when we try to read usb via listFiles(). I have an usb with 1000+ pictures and this method return only a part of them. For different file sizes it returns a different amount, so I guess this might be related to some buffer size or any other memory related stuff. I tried this with different USB and SD cards(connected via OTG adapter) on different Andorid 11 devices.

Code where problem occurs

val currentFs = storageDevice.partitions[0].fileSystem
val rootDir = fileSystem.rootDirectory
val files = rootDir.listFiles()

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
magnusjacommented, Mar 15, 2022

You need to download libusb 1.0.25 and set libusb.dir to the path where you extracted the source tarball. See gitlab ci for more info. https://github.com/magnusja/libaums/blob/566a5a9c8dd64a32fc1627b5d7de383d79abe12d/.github/workflows/android.yml#L16-L19

0reactions
Mahmoud-Mustafa-Devcommented, Apr 16, 2022

@magnusja @vasiledoe Anything new with this issue? I am facing the same thing, I have 1k images and the listFiles() is only returning 300 of them . Update: Version v0.7.1 does not have this issue and it’s working fine for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solved: Cannot Open Files on USB Flash Drive
Open files that are invisible on USB flash drive · 1. Press Windows+R simultaneously, type “cmd” and hit “Enter” key to run Command...
Read more >
Cannot Open USB Flash Drive on Windows 10 and Access File!
1. Try the USB Drive on Another PC/Laptop · 2. Try to Recover Files from USB Drive · Wondershare Recoverit Software · 3....
Read more >
[SOLVED] USB Drive not Showing Files and Folders + 5 ...
This post lists 5 methods to help you solve the USB drive not showing files and folders issue with easily and quickly.
Read more >
I can't access the files in my USB drive, what should I do?
If it does power on and shows up in windows explorer but you cannot access the files, then it may be due to...
Read more >
Can Not Access USB Drive Windows 10 - EaseUS
When you can't access a USB drive on Windows 10, 8, or 7, a quick way to fix this issue is to change...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found