Problem with App Inventor Built: October 19 2022 Version: nb190b

I am having problems with the File component method AppendToFile recently in both the Companion (ver 2.65). I have added the screen method ErrorOccurred with a Notifier to display the message.
The filename for the method is /Download/Data2210231600.csv.
From the compiled app the results are as follows.
With Shared scope the error is
Cannot write to file /storage/emulated/0
With Legacy scope the error is
Cannot write to file /Data/user/0/appinventor.ai_iainboyle314.BTServer/files

In the companion similar messages are given.

There is no mention of the directory or file name.

Up until yesterday I was having no problems with Android 9 only with Android 13.

Any thoughts?


Hello Iain

You can only write to the file in Download if your App created the file - I assume that it did not, given it's location. I suggest you download to the App's ASD instead. Use Anke's extension version2:

Hi Chris

The app is creating the file. I have used the same blocks on Android 9 in previous apps to get data from the app to the shared Download folder so it can be exported for use on a PC. They all work OK.

I installed one of these apps on my new Android 13 device and got write permission errors.
I have tried most of the things I could find in the posts here to get it to work with little success.

The current problem is occurring with my Android 9 device which never happened before.


Show your (relevant) blocks.

See also e.g. here:

apologies to all.
It was my bad programming.
The file writing was happening inside a timer loop and I was using a variable inside the loop to store the filename. Changed this to a Global variable and all OK.
I think Android 13 has got to me.
Thanks for the suggestions.

1 Like

It would be helpful if we could understand where your problem was and how you fixed it. So show your blocks before and after. This would allow other users to learn from it as well.

Hi Anke
I have uploaded the 2 blocks image
The error was to have the variable Fname in the timer block.
The fix was to have a Global variable GFname outside the timer block and to replace Fname with GFname.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.