easydeviceinfo icon indicating copy to clipboard operation
easydeviceinfo copied to clipboard

Invalid External Storage Path

Open rayliverified opened this issue 5 years ago • 2 comments

I got the following crash from an user on a Samsung Galaxy Tab 2 (Android 9.0)

Fatal Exception: java.lang.IllegalArgumentException
Invalid path: /storage/emulated/0
android.os.StatFs.doStat (StatFs.java:51)
android.os.StatFs.<init> (StatFs.java:41)
github.nisrulz.easydeviceinfo.base.EasyMemoryMod.getAvailableExternalMemorySize (EasyMemoryMod.java:147)
Caused by android.system.ErrnoException
statvfs failed: ENOENT (No such file or directory)
libcore.io.Linux.statvfs (Linux.java)
libcore.io.BlockGuardOs.statvfs (BlockGuardOs.java:333)
android.system.Os.statvfs (Os.java:570)
android.os.StatFs.doStat (StatFs.java:49)
android.os.StatFs.<init> (StatFs.java:41)
github.nisrulz.easydeviceinfo.base.EasyMemoryMod.getAvailableExternalMemorySize (EasyMemoryMod.java:147)

A quick StackOverflow search shows me that the reason it crashes is because you can't assume that an external storage exists.

Currently wrapping getAvailableExternalMemorySize() in a try catch to prevent crash.

rayliverified avatar Sep 22 '19 22:09 rayliverified

Thanks for creating this library, it's fantastic :)

rayliverified avatar Sep 22 '19 22:09 rayliverified

Good catch. I will add that and more fixes related to this soon.

Thank you for reporting this issue.

nisrulz avatar Sep 23 '19 08:09 nisrulz