ERROR 2001 The file could not be found on your device

1,904 views
Skip to first unread message

Rage NLN

unread,
Mar 3, 2016, 3:48:54 PM3/3/16
to MIT App Inventor Forum
For my app, Diabetic Tracker V2 found here: http://ai2.appinventor.mit.edu/#5299413839773696, I am saving a simple txt file called "DiabeticTracker1.txt" which contains the data that is put in on the main screen. Then there is an option to got to an "All Readings" screen and see the history of the readings taken. I want the user to be able to Share/Send" that file by whatever means they wish. 

The problem I'm having is when the Share button is clicked I'm getting the error "ERROR 2001: The file DiabeticTracker.txt could not be found on your device" But it has to be there because screen 3 is reading it and displaying it, right?

I read this forum post https://groups.google.com/forum/#!topic/mitappinventortest/NCKPzCzr5DM in which it was suggested that the file path may be incorrect, but I've never set a file path. In the attached pic "save_file_block.png" (if you can see it, I had to zoom out to fit it all on the screen), there is no mention of a save location. When I originally set his up, months ago, I assumed it saved it in the apps folder location automatically because, like I stated, screen 3 can read it and display it without any issue.

I should also mention that the initial "save" is done on screen 1, and it saves 2 files. One is the "All readings" and one is "last reading" which is displayed on screen 1 when you open the app, that way you can see the last time you checked and how much insulin you took.

I can also rule out the naming issue, where DiabeticTracker1.txt is different from diabetictracker1.txt. I've gone through my work and made sure everything was named accordingly.

Any thoughts?
save_file_block.png
reading_saved_file_blocks.png
share_file_block.png

Taifun

unread,
Mar 3, 2016, 6:02:52 PM3/3/16
to MIT App Inventor Forum
the sharing component only can share files from the sdcard, but not from the assets or the private data directory

you could read the file on first run of the app and save it on sdcard, later then append to the file on sdcard and share from there

for the sharing component, use the full path to the file on sdcard, for example file:///mnt/sdcard/DiabeticTracker1.txt

Taifun

Trying to push the limits of App Inventor! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun. 

Rage NLN

unread,
Mar 3, 2016, 6:09:10 PM3/3/16
to MIT App Inventor Forum
That makes sense. Since I'm not specifying where to save it, the file is automatically being saved with the assets or the private data directory and can't be shared.

I will work on it.

Thanks so much!

Rage NLN

unread,
Mar 4, 2016, 7:45:55 PM3/4/16
to MIT App Inventor Forum
I need help still. I'm following the reference guide here: http://ai2.appinventor.mit.edu/reference/components/storage.html#File but I notice it doesn't say state the same info for appending a file. For reading and saving it states to add a slash / before the file name: "/myFile.txt will write the file in /sdcard/myFile.txt" but I tried appending all my file names with the slash / and I still can't seem to save it to the sd card. 
I thought that maybe the issue was my phone, Lenovo A936, and for some reason Lenovo's version of Android is all screwy, so I tried my girlfriends LG G3 and I'm getting the same issue.
I've attached a screenshot from my Lenovo in case it helps.
Screenshot_2016-03-04-00-21-07-553.jpeg

Taifun

unread,
Mar 4, 2016, 8:18:16 PM3/4/16
to MIT App Inventor Forum
if you store the file like this /DiabeticTracker1.txt then the full path for the sharing component is file:///mnt/sdcard/DiabeticTracker1.txt
Taifun

Rage NLN

unread,
Mar 4, 2016, 8:36:00 PM3/4/16
to MIT App Inventor Forum
Awesome! Thanks for the help!
Reply all
Reply to author
Forward
0 new messages