Utils.determineBytesAvailable - crashes if file not found
https://couchdb.ankidroid.org/acralyzer/_design/acralyzer/index.html#/report-details/837d55f8-55c8-494c-a556-88dd9592b372
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:318)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:762)
Caused by: java.lang.IllegalArgumentException: Invalid path: /storage/emulated/0/Anki/collection.anki2
at android.os.StatFs.doStat(StatFs.java:46)
at android.os.StatFs.<init>(StatFs.java:39)
at com.ichi2.libanki.Utils.determineBytesAvailable(Utils.java:1)
at com.ichi2.libanki.importer.AnkiPackageImporter.run(AnkiPackageImporter.java:88)
at com.ichi2.async.CollectionTask.doInBackgroundImportAdd(CollectionTask.java:7)
at com.ichi2.async.CollectionTask.actualDoInBackground(CollectionTask.java:36)
at com.ichi2.async.CollectionTask.doInBackground(CollectionTask.java:2)
at com.ichi2.async.CollectionTask.doInBackground(CollectionTask.java:1)
at android.os.AsyncTask$2.call(AsyncTask.java:304)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
... 4 more
Caused by: android.system.ErrnoException: statvfs failed: ENOENT (No such file or directory)
at libcore.io.Posix.statvfs(Native Method)
at libcore.io.BlockGuardOs.statvfs(BlockGuardOs.java:304)
at android.system.Os.statvfs(Os.java:506)
at android.os.StatFs.doStat(StatFs.java:44)
... 13 more
Nothing in the logs
The settings point to the same deck path
| deckPath | /storage/emulated/0/Anki |
|---|
Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically
Does this happened on a Samsung device ?
Samsung Galaxy S6 (G920F - International Variant)
This happens mostly in Samsung devices only. Probably in such cases we can use getFilesDir. Your views ?
@david-allison old link is broken. Is it possible this is an old API we no longer support?
Currently: https://github.com/ankidroid/Anki-Android/blob/6be7cdbc414c808a272f177d26c11a8339b7edbf/AnkiDroid/src/main/java/com/ichi2/utils/FileUtil.kt#L34-L42
Now we're in Kotlin, this should be trivially fixable by changing String? to String