Bug 424541 - Cannot save on Android app
Summary: Cannot save on Android app
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: File formats (show other bugs)
Version: unspecified
Platform: Android Android 10.x
: NOR critical
Target Milestone: ---
Assignee: sh_zam
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-22 15:32 UTC by Matt McFarland
Modified: 2020-09-28 06:51 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Device Settings Log (2.33 KB, text/plain)
2020-07-23 17:13 UTC, Matt McFarland
Details
Krita logs generated while error was occurring (382.99 KB, text/plain)
2020-07-23 17:14 UTC, Matt McFarland
Details
Screenshot of in-app logs with permission error (905.24 KB, image/jpeg)
2020-07-24 15:27 UTC, Matt McFarland
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matt McFarland 2020-07-22 15:32:35 UTC
SUMMARY
I’m testing out the new Android beta on my Samsung Galaxy S6 Lite, and at first it was working great, but now I’m getting errors whenever I try to save. Sometimes the error is just a simple “Unknown Error”, other times it’s an “Error occurred while writing to the file”. The file location I’m using is the device local storage, “/storage/emulated/0/Documents/Krita projects/filename.kra”. I created the Krita Projects folder, and I was able to save projects in that location previously, but halfway through working on that project I started getting this error and I can no longer seem to save any projects.

STEPS TO REPRODUCE
1. Worked on painting for approximately an hour, had about 6-7 layers
2. Clicked save option, window opened option to save as JPG, which is not what I wanted
3. Went to File > Save As, navigated through file browser and created Krita Projects folder at the location "/storage/emulated/0/Documents", and saved as Krita Project file successfuly.
4. Continued work on project, now offline, autosave worked about twice, then started failing with an unknown error. 
5. Attempted saving with the File > Save As menu, same as before, and got an unknown error. Opened a new project and tried saving it, unknown error. 
6. Went home and connected to internet, tried working on another new project and using the File > Save As option and got the error "Error occurred while writing to the file"
7. Additionally tried saving as JPG from the shortcut on the top menu bar, same error as step 6. 

OBSERVED RESULT
Have not been able to save for days across multiple new projects.

EXPECTED RESULT
To be able to save files.

SOFTWARE/OS VERSIONS
Android: Samsung Galaxy Tab S6 Lite
Android 10
One UI version 2.1
Kernel Version 4.14.113.18723785
Krita version 4.3.1-alpha (git 8798b4d)

ADDITIONAL INFORMATION
The tablet is very new, had little else installed on it at the time of failure and very little customization done to the tablet, aside from changing the device wallpaper and to dark theme it's pretty much stock. I also have not tried reinstalling the application, just in case that actually fixes the issue I wanted to make sure the devs have all the info they need before I get a working app on my tablet again.
Comment 1 sh_zam 2020-07-23 05:48:46 UTC
Hello! Thanks for the detailed report! Unfortunately, there is no straight way to reproduce this :(

So, could you please do these to give us more insight into this bug: 

1) Click on Menu (Top Left) > Settings > Dockers > Check "Log Viewer". 

2) Log Viewer docker should be created and then you can enable "File loading and saving" and then perform the buggy action. 

3) Then you can try to save the log from Log Viewer by clicking save button in it. If it doesn't work, perhaps you can scroll and see some additional relevant info about the error, which you can screenshot and attach?
Comment 2 Matt McFarland 2020-07-23 17:13:45 UTC
Created attachment 130340 [details]
Device Settings Log
Comment 3 Matt McFarland 2020-07-23 17:14:53 UTC
Created attachment 130341 [details]
Krita logs generated while error was occurring

I noticed not much was happening on the logs until the error, then it was flooded with permission denied errors as I tried to save or even just navigate my files.
Comment 4 sh_zam 2020-07-23 17:36:10 UTC
(In reply to Matt McFarland from comment #3)
> Created attachment 130341 [details]
> Krita logs generated while error was occurring
> 
> I noticed not much was happening on the logs until the error, then it was
> flooded with permission denied errors as I tried to save or even just
> navigate my files.

Thanks for the logs! A quick thing which comes to mind from this is if the permission was revoked by the system (I doubt this would happen, but Android docs suggest not to assume anything about system).

Could you check if Krita's has been given Storage permission in App Info? 
https://support.google.com/android/answer/9431959?hl=en
Comment 5 Matt McFarland 2020-07-23 20:35:34 UTC
(In reply to Sharaf from comment #4)
> Thanks for the logs! A quick thing which comes to mind from this is if the
> permission was revoked by the system (I doubt this would happen, but Android
> docs suggest not to assume anything about system).
> 
> Could you check if Krita's has been given Storage permission in App Info? 
> https://support.google.com/android/answer/9431959?hl=en

Just checked, storage permissions are allowed and it also says nothing is denied. Also as a note, I was able to save successfully 2 or 3 times before the error came in again, it seems like it starts failing after I use Krita for a little bit, like 5-10 minutes, so I don't think it's necessarily a simple storage issue.
Comment 6 sh_zam 2020-07-24 07:11:06 UTC
I don't see anything permission related in the logs you shared :(

If you can either type out one or two errors or screenshot them, please do. I have to see what exactly is denying the permission to find the locus.
Comment 7 Matt McFarland 2020-07-24 15:27:43 UTC
Created attachment 130369 [details]
Screenshot of in-app logs with permission error

Strange that the error wasn't included in the logs. I still had the app open from before, so the screenshot attached are the same errors I was getting while recording the logs last time.
Comment 8 sh_zam 2020-07-24 19:02:53 UTC
Thanks!

Yes, this is certainly a bug. I will try to look into the whole saving mess tomorrow.
Comment 9 sh_zam 2020-09-25 10:22:35 UTC
Git commit 1fbe9652548e5eaf5bc195efb6bd0c0de9e131bf by Sharaf Zaman.
Committed on 25/09/2020 at 10:20.
Pushed by szaman into branch 'krita/4.3'.

Android: Use Storage Access Framework for all file operations
Related: bug 423670

A  +973  -0    3rdparty/ext_qt/0047-platform-android-Add-native-file-dialog.patch
A  +165  -0    3rdparty/ext_qt/0048-Android-Properly-close-the-File-Descriptor.patch
A  +171  -0    3rdparty/ext_qt/0049-Android-Workarounds-to-explicitly-handle-content-URI.patch
M  +8    -0    3rdparty/ext_qt/CMakeLists.txt
M  +21   -0    libs/koplugin/KisMimeDatabase.cpp
M  +30   -0    libs/ui/KisAndroidFileManager.cpp
M  +5    -1    libs/ui/KisAndroidFileManager.h
M  +0    -4    libs/ui/KisDocument.cpp
M  +0    -6    libs/ui/KisMainWindow.cpp
M  +3    -0    libs/ui/dialogs/kis_dlg_preferences.cc
M  +10   -0    libs/widgetutils/KoFileDialog.cpp

https://invent.kde.org/graphics/krita/commit/1fbe9652548e5eaf5bc195efb6bd0c0de9e131bf
Comment 10 sh_zam 2020-09-25 10:29:33 UTC
Git commit cd48cc01a36693aa831d857e3a89227c2e9abeee by Sharaf Zaman.
Committed on 25/09/2020 at 10:27.
Pushed by szaman into branch 'master'.

Android: Use Storage Access Framework for all file operations
Related: bug 423670

(cherry-picked from 1fbe9652548e5eaf5bc195efb6bd0c0de9e131bf)

# Conflicts:
#	libs/ui/KisMainWindow.cpp

A  +973  -0    3rdparty/ext_qt/0047-platform-android-Add-native-file-dialog.patch
A  +165  -0    3rdparty/ext_qt/0048-Android-Properly-close-the-File-Descriptor.patch
A  +171  -0    3rdparty/ext_qt/0049-Android-Workarounds-to-explicitly-handle-content-URI.patch
M  +8    -0    3rdparty/ext_qt/CMakeLists.txt
M  +21   -0    libs/koplugin/KisMimeDatabase.cpp
M  +30   -0    libs/ui/KisAndroidFileManager.cpp
M  +5    -1    libs/ui/KisAndroidFileManager.h
M  +0    -4    libs/ui/KisDocument.cpp
M  +0    -6    libs/ui/KisMainWindow.cpp
M  +3    -0    libs/ui/dialogs/kis_dlg_preferences.cc
M  +10   -0    libs/widgetutils/KoFileDialog.cpp

https://invent.kde.org/graphics/krita/commit/cd48cc01a36693aa831d857e3a89227c2e9abeee
Comment 11 Dmitry Kazakov 2020-09-28 06:51:01 UTC
Git commit 8fd4bee9648113321bcdd65ce06c190a224caab3 by Dmitry Kazakov, on behalf of Sharaf Zaman.
Committed on 28/09/2020 at 06:48.
Pushed by dkazakov into branch 'krita/4.4.0'.

Android: Use Storage Access Framework for all file operations
Related: bug 423670

A  +973  -0    3rdparty/ext_qt/0047-platform-android-Add-native-file-dialog.patch
A  +165  -0    3rdparty/ext_qt/0048-Android-Properly-close-the-File-Descriptor.patch
A  +171  -0    3rdparty/ext_qt/0049-Android-Workarounds-to-explicitly-handle-content-URI.patch
M  +8    -0    3rdparty/ext_qt/CMakeLists.txt
M  +21   -0    libs/koplugin/KisMimeDatabase.cpp
M  +30   -0    libs/ui/KisAndroidFileManager.cpp
M  +5    -1    libs/ui/KisAndroidFileManager.h
M  +0    -4    libs/ui/KisDocument.cpp
M  +0    -6    libs/ui/KisMainWindow.cpp
M  +3    -0    libs/ui/dialogs/kis_dlg_preferences.cc
M  +10   -0    libs/widgetutils/KoFileDialog.cpp

https://invent.kde.org/graphics/krita/commit/8fd4bee9648113321bcdd65ce06c190a224caab3