fluttercandies / saver_gallery

MIT License
15 stars 15 forks source link

[Bug report] #19

Open hugocornellier opened 4 days ago

hugocornellier commented 4 days ago

Version

3.0.6

Platforms

dart, Android

Device Model

Galaxy A11 (Android 12)

flutter info

[✓] Flutter (Channel stable, 3.24.3, on macOS 14.6.1 23G93 darwin-x64, locale en-CA)
    • Flutter version 3.24.3 on channel stable at /Users/hugo/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2663184aa7 (12 days ago), 2024-09-11 16:27:48 -0500
    • Engine revision 36335019a8
    • Dart version 3.5.3
    • DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at /Users/hugo/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)

[✓] IntelliJ IDEA Community Edition (version 2024.2.0.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 81.1.3
    • Dart plugin version 242.20629

[✓] Connected device (4 available)
    • SM A115W (mobile)      • R95NA0CZF5P               • android-arm    • Android 12 (API 31)
    • Hugo’s iPhone (mobile) • 00008130-000270262441401C • ios            • iOS 17.5.1 21F90
    • macOS (desktop)        • macos                     • darwin-x64     • macOS 14.6.1 23G93 darwin-x64
    • Chrome (web)           • chrome                    • web-javascript • Google Chrome 128.0.6613.138

[✓] Network resources
    • All expected network resources are available.

• No issues found!

How to reproduce?

On Android 12, when you attempt to call saveFile without the androidRelativePath parameter, the entire app crashes without any error messages or logs. Once androidRelativePath is added, it seems to work fine. There should be an error thrown here to indicate to the user that androidRelativePath is required.

Logs

There are no logs or errors thrown. The app crashes without any logs.

Example code (optional)

On Android 12, this causes a crash and there is no indication of what the issue is. There should be at least an error thrown saying that it is crashing because Android Relative Path is empty.

This crashes:

final SaveResult result = await SaverGallery.saveFile(
     file: filePath,
     name: name,
     androidExistNotSave: false
);

This works:

final SaveResult result = await SaverGallery.saveFile(
     file: filePath,
     name: name,
     androidRelativePath: "Pictures/AppName/xx",
     androidExistNotSave: false
);

Contact

hugo.cornellier@gmail.com

zhangruiyu commented 4 days ago

currently on Android, Android RelativePath is required, maybe it's not written that way, so I'm going to add a more explicit identifier androidRelativePath in the next version