Some phones can't read files


Hi! I have a program wich shares a file with friends; but i have a problem. I think the url i put works wile emulating with appybuilder companion but using the apk in friends phone’s it don’t work and shows this error:


I can’t find where are the assets files in the phone when the app is installed by apk.

In the other hand, share component instruction says:

  • "file:///sdcard/Appinventor/assets/arrow.gif"
    or* "/storage/Appinventor/assets/arrow.gif

So how can i do to make an if block where if the file isn’t under “file:///sdcard/appinventor” root, go for “/storage/”.

Could be this error 2001 managed as a variable?

This are my block:


yes, this is correct, that path does not exist, because the correct path is file:///mnt/sdcard and that path only exists while developing your app on your development device and does not exist for the built app on other devices.

To share a file from the assets you first have to copy the file to the internal sdcard and then share from there. You can use the file extension to copy a file


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


Thanks! So for understanding it i will do some more questions:

  1. the assets that are packed in the apk aren’t accesible from outside from the app? (With a file explorer for example)

  2. in your link says: " **Note: I decided to not add the SDK 26 functionality into this extension ."

I need for sdk 26 and newer so is there any option?

For what i want to do is the same tp take a screenshot of the screen; becausr that image tjat i wanna share at that time is displayed; but i rejected screenshot because it need camera permission is there another way to get screenshot without camera? I dont understand at all why it need camera permission because it doesnt use camara



which means, if your app does not need the permission WRITE_EXTERNAL_STORAGE elsewhere, you have to ask for that permission manually using the AskForPermission method from the Screen drawer

how do you take a screenshot currently? a screenshot of your relevant blocks would be nice…
what about using the screenshot extension?



I actually dont take screenshots; i tried to do it with camera element but discarded cause it ask for camera permission.

My app ask fpr this permission, i think it os from the tinydb component.

So this mean i already have the write permission ?
Sorry i dont understand at all permissions and never asked manually for it


I think i am going to use this block

So in the upper text block (from assets) you put: //filename.fileextension

But in the second; the directory ai/filename.fileextension is for using the companion? Or it will work with the final apk?

And finally if file already exist, this block will overwrite it or it will get an error?



of course it will work for the companion as well as after building the app… else it would be useless…
you might want to read the documentation of the file extension to realize, that you can use a full path or a relative path…



Very very thanks to you Taifun. I finally solved the problem using your file extension and these blocks:

So my question is, using the blocks this way, it should work in all phones, those whose got the root * "file:/// and those who have the root"/storage/…


yes (filling up to 20 characters)