Problem with July 30 2020 Version: nb184 no longer able to write and read files

Works fine here using Companion to store, retrieve and delete.

The attached example contains a csv file in Assets. The app copies the file to the / sdcard and posts its contents to the TextBox. Now, modify the file in the TextBox, then save the modified file (to the / sd card) using the SaveFile. Wait a second and now uUse the LoadFile from sd card / button and it works (the file saved to the sd card loads)
.

Now use the Delete. Delete removes the file. How do I know? LoadFile from sd card button and it elicits an error 2101 (file cannot be found :slight_smile: ).

Regards
Steve

Where is your example?

FileControl.aia (2.6 KB)

Galaxy TAB A with Android 10.
Again: My App loaded on the tablet and built before July7 is perfectly working. When opening the hitherto smoothly working App with the new Version and loading this modified APP to the tablet it falters.
Just tell me how to roll the App Inventor back to the previous version so that I may continue with my development..

Thnaks. The problem in general with the Samsung Tablet Android 10 is that it loads and finds the /files only to the TAB root directory , but thsi has before never been a problem.
I would appreciate to learn how to roll back may APPInventor to the previous version, when all was working smoothly.
Shall a sent the complete APP (the one still working on my tablet) and the newly no longer working APP ?

I am having the exact same problem as @H_K_Buecher reported. I am running android 10. While is true that example provided by SteveJG works, that is the only combination it does(private internal folder). If you want to save in a given public folder of your external storage you can't . Just a few days ago it was possible. The same application that worked now does not. You still can save in the root (/) , but then you cant retrieve the information

Got the same problem with creating .csv files as you guys.

No, it is written to the app-specific directory (ASD):

Companion:

/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files

compiled app (APK):

/storage/emulated/0/Android/data/<packageName>/files

Cause:
The file component (for API level ≥ 29) adds the ASD path to the beginning of each path that you declare.

If I save a text in the ASD

this path is returned (but doesn't exist and cannot be created):

/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/Android/data/edu.mit.appinventor.aicompanion3/files/text.txt.

Therefore you get an error message.

When I create a new directory (/myDir/storage/emulated/0/myDir (using the TaifunFile extension, → WRITE permission granted!): App Inventor Extensions: File | Pura Vida Apps

this directory is created without any problems. However, the file component points to this path:

/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/myDir

However, this path does not exist, which is why you get an error message.

This is a bug (on devices with API level ≥ 29, no issues on Android 9 devices) @ewpatton @Susan_Lane

Solution / workaround (checked): Use the EFile extension from @vknow360:

@Ignacio_Escribano @wojti99

4 Likes

Needs a small correction.
The correct path is:
/storage/emulated/0/AppInventor/data

But that path also exists on my phone :worried:

No, the ASD is:

/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files

Oh...got it.
You are using ASD block which will return path of running app's ASD.

An AppInventor with the a version before nb184 should be made available, to allow working on APP developed before July 7th, until the reported bug issue has been solved. Keep in mind, opening a working APP with the nb184 Versions renders before flawlessly working APP useless.

LC_Abfrage_60.aia (132.5 KB)

There is an offline version of AI2 (nb183c), but it won't help you because it still targets API 28. Since Aug. 3, all new apps must target API 29 (Android 10) (targetSdkVersion = 29).

However, if you want to update an app published before Aug. 3, you can use the offline version. Otherwise you can use the EFile extension (until the bug is fixed), as I said earlier.

Dear Anke,
thanks for the comprehensive reply.
How "soothing" not to receive "a wise crack" answer but a clear statement, that the bug exists and a remedy is promised.
Again thank You.
Hermann Buecher

Thank you. I 'll go with efile until de bug is fixed.

when you say " There is an offline version of AI2 (nb183c), but it won't help you because it still targets API 28. Since Aug. 3, all new apps must target API 29 (Android 10) (targetSdkVersion = 29)." . That is if I pretend to publish in play store, but if I only want to install it myseft with the apk I should by fine with offline version , don't I?

Check this APK on your test devices (Android 9, 10):

Blocks

Screenshot on Android 9

Yes, of course.

Yes, download AI2offline version with nb 183

that version of AI2offline uses the nb183 Companion.

I have already posted the link:

For those of you encountering issues reading files on Android 10, you should try loading your app into this test server and test it with the corresponding companion.

In this version, the File component gains a LegacyMode property. You will need to set this property to true in order to read files from outside the app-specific directory.

Note, this will only work for another year or so. Starting with Android 11, Google will no longer allow apps to read outside of their app-specific directories. You should read "Migrate data to directories that are visible when using scoped storage" to understand the implications of what you need to do. App Inventor cannot migrate your data for you, but this flag will allow you time to update your app over the coming year to be compatible. If you fail to migrate, an upgrade to Android 11 may cause your app to stop working and there will be nothing we can do for you.

3 Likes

(added to FAQ)