Samoy / image_save

Save image to album or sandbox
https://pub.dev/packages/image_save
MIT License
23 stars 27 forks source link

安卓10保存图片失败 #13

Closed nekomiyaxneko closed 3 years ago

nekomiyaxneko commented 3 years ago

在荣耀9(安卓9)上保存图片没问题 在realme x7 pro(安卓10)上保存图片失败 存储权限都确认给了 报错情况如下: W/System.err( 5536): java.io.FileNotFoundException: /storage/emulated/0/Pictures/Lugoby/IMG_20210119_132512_767073.jpg: open failed: EACCES (Permission denied) W/System.err( 5536): at libcore.io.IoBridge.open(IoBridge.java:538) W/System.err( 5536): at java.io.FileOutputStream.(FileOutputStream.java:235) W/System.err( 5536): at java.io.FileOutputStream.(FileOutputStream.java:186) W/System.err( 5536): at com.samoy.image_save.ImageSavePlugin.saveImage(ImageSavePlugin.java:109) W/System.err( 5536): at com.samoy.image_save.ImageSavePlugin.saveImageCall(ImageSavePlugin.java:88) W/System.err( 5536): at com.samoy.image_save.ImageSavePlugin.methodCall(ImageSavePlugin.java:68) W/System.err( 5536): at com.samoy.image_save.ImageSavePlugin.onMethodCall(ImageSavePlugin.java:58) W/System.err( 5536): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233) W/System.err( 5536): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85) W/System.err( 5536): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692) W/System.err( 5536): at android.os.MessageQueue.nativePollOnce(Native Method) W/System.err( 5536): at android.os.MessageQueue.next(MessageQueue.java:336) W/System.err( 5536): at android.os.Looper.loop(Looper.java:184) W/System.err( 5536): at android.app.ActivityThread.main(ActivityThread.java:7878) W/System.err( 5536): at java.lang.reflect.Method.invoke(Native Method) W/System.err( 5536): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:512) W/System.err( 5536): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1028) W/System.err( 5536): Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied) W/System.err( 5536): at libcore.io.Linux.open(Native Method) W/System.err( 5536): at libcore.io.ForwardingOs.open(ForwardingOs.java:167) W/System.err( 5536): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252) W/System.err( 5536): at libcore.io.ForwardingOs.open(ForwardingOs.java:167) W/System.err( 5536): at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7768) W/System.err( 5536): at libcore.io.IoBridge.open(IoBridge.java:524) W/System.err( 5536): ... 16 more

xalanq commented 3 years ago

Same here.

Reference: https://developer.android.com/training/data-storage#scoped-storage

Temporary solution:

Edit AndroidManifest.xml, add this:

<manifest ... >
  <application android:requestLegacyExternalStorage="true" ... >
    ...
  </application>
</manifest>

via: https://medium.com/@sriramaripirala/android-10-open-failed-eacces-permission-denied-da8b630a89df

Rickyballs commented 3 years ago

https://blog.csdn.net/wqs1028/article/details/113618069 Can solve this problem!

Samoy commented 3 years ago

Resolved, see latest version.