App crashes with exception java.io.FileNotFoundException: open failed: ENOENT
See original GitHub issueWhen the image is passed to the plugin it crashes the application. If there is a FileNotFoundException then the plugin should throw an Exception to flutter.
Here are the Logs
I/flutter ( 7398): APPLOGS : saveFileToLocal /data/user/0/com.package.name/cache/image_cropper_1583319540032.jpg
W/MediaStore( 7398): Failed to obtain thumbnail for content://media/external/images/media/1757
W/MediaStore( 7398): java.io.FileNotFoundException: open failed: ENOENT (No such file or directory)
W/MediaStore( 7398): at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:149)
W/MediaStore( 7398): at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:705)
W/MediaStore( 7398): at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1694)
W/MediaStore( 7398): at android.content.ContentResolver.openTypedAssetFile(ContentResolver.java:1599)
W/MediaStore( 7398): at android.content.ContentResolver.lambda$loadThumbnail$0(ContentResolver.java:3623)
W/MediaStore( 7398): at android.content.-$$Lambda$ContentResolver$7ILY1SWNxC2xhk-fQUG6tAXW9Ik.call(Unknown Source:10)
W/MediaStore( 7398): at android.graphics.ImageDecoder$CallableSource.createImageDecoder(ImageDecoder.java:550)
W/MediaStore( 7398): at android.graphics.ImageDecoder.decodeBitmapImpl(ImageDecoder.java:1847)
W/MediaStore( 7398): at android.graphics.ImageDecoder.decodeBitmap(ImageDecoder.java:1840)
W/MediaStore( 7398): at android.content.ContentResolver.loadThumbnail(ContentResolver.java:3622)
W/MediaStore( 7398): at android.content.ContentResolver.loadThumbnail(ContentResolver.java:3606)
W/MediaStore( 7398): at android.provider.MediaStore$InternalThumbnails.getThumbnail(MediaStore.java:1579)
W/MediaStore( 7398): at android.provider.MediaStore$Images$Thumbnails.getThumbnail(MediaStore.java:1938)
W/MediaStore( 7398): at carnegietechnologies.gallery_saver.FileUtils.insertImage(FileUtils.kt:80)
W/MediaStore( 7398): at carnegietechnologies.gallery_saver.GallerySaver$saveMediaFile$1$success$1.invokeSuspend(GallerySaver.kt:69)
W/MediaStore( 7398): at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
W/MediaStore( 7398): at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:238)
W/MediaStore( 7398): at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594)
W/MediaStore( 7398): at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60)
W/MediaStore( 7398): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:742)
E/AndroidRuntime( 7398): FATAL EXCEPTION: main
E/AndroidRuntime( 7398): Process: com.package.name, PID: 7398
E/AndroidRuntime( 7398): java.lang.IllegalStateException: miniThumb must not be null
E/AndroidRuntime( 7398): at carnegietechnologies.gallery_saver.FileUtils.insertImage(FileUtils.kt:83)
E/AndroidRuntime( 7398): at carnegietechnologies.gallery_saver.GallerySaver$saveMediaFile$1$success$1.invokeSuspend(GallerySaver.kt:69)
E/AndroidRuntime( 7398): at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
E/AndroidRuntime( 7398): at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:238)
E/AndroidRuntime( 7398): at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594)
E/AndroidRuntime( 7398): at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60)
E/AndroidRuntime( 7398): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:742)
I/System.out( 7398): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out( 7398): (HTTPLog)-Static: isSBSettingEnabled false
I/Process ( 7398): Sending signal. PID: 7398 SIG: 9
Here the save function
static Future<Null> saveFileToLocal(File file) async {
appLogs("saveFileToLocal ${file.path}");
try {
//Save file local storage as well.
final result = await GallerySaver.saveImage(
file.path,
albumName:"App Name",
);
appLogs("saveFileToLocal result $result");
} catch (e, s) {
appLogs(" saveFileToLocal ERROR $e\n$s");
}
return null;
}
device info
SAMSUNG G973F • RZ8M309W8JJ • android-arm64 • Android 10 (API 29)
flutter doctor
[✓] Flutter (Channel beta, v1.14.6, on Mac OS X 10.15.3 19D76, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.5)
[!] VS Code (version 1.42.1)
✗ Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (3 available)
! Doctor found issues in 1 category.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:13
- Comments:12 (1 by maintainers)
Top Results From Across the Web
android - java.io.FileNotFoundException: /storage/emulated/0 ...
So first fix any mistakes such as assuming what the path will be on a given device, or program logic errors that cause...
Read more >No DRP key due to exception:java.lang ... - Issue Tracker
ServiceThread.run(ServiceThread.java:46) Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory) at libcore.io.
Read more >FileNotFoundException intermittently occurs on the Android ...
When calling track() of the amplitude SDK, the app crashes with a FileNotFoundException error.It's a very occasional error, but I don't know ...
Read more >File Not Found Error on Update - open failed: ENOENT - GitLab
Same updating Firefox Nightly. Aurora Store v4.0.2.33, android 10. java.io.FileNotFoundException: open failed: ENOENT (No such file or directory) ...
Read more >1.png: open failed: ENOENT (No such file or directory) - B4X
RuntimeException : java.io.FileNotFoundException: /storage/emulated/0/Android/data/takziv.financhick.com/files/virtual_assets/1.png: open ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Has anyone found a solution?
I think this is due to targeting Android 10 (API Level 29) which has a new downloads structure