Storage/emulated/0/pictures/picture.jpg open failed EACCESS(Permission denied)

Hi,
i'm developing an App that takes one picture per hour, based on a file CSV in drive.
It worked fine until today. Then this error appeared: Storage/emulated/0/pictures/picture.jpg open failed EACCESS(Permission denied)

These are my relevant blocks:

I'm under Android 11, and the only changes in the app before the error didn't touch permissions or photo taking/uploading.

Only the getASD procedure was taken from another topic, trying to find a solution. It didn't change anything.
Any ideas?

starting from SDK33 you have to ask for READ_MEDIA_IMAGES permission

Taifun

Try the last Project aia you are regularly saving as you code that worked and see if that version loaded.

I tried it, nothing worked.

see taifun's advice, you now need to provide appropriate permissions.

where exactly in your screenshot do you try to access a picture in that path?
we only can see you accessing a picture in ASD...

Taifun

:question:

Does this mean 10 or below, or 11 ?

I tried this solution, nothing changed. My phone didn't even tried to ask the new permission

I mean Android 11

When I apply the function "getASD", it returns that address...

I can't see anything in your blocks that might call an image from:

/storage/emulated/0/pictures/picture.jpg

no...
provide a Do it result to prove it
Taifun

This is the "Do it"

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

And that actually makes no sense. I never try to call an image from the path that generates the error...

well, this is the ASD of the companion app and this is what the getASD procedure tries to return
you have to check your blocks to find out, where that error

Storage/emulated/0/pictures/picture.jpg open failed EACCESS(Permission denied)

comes from
Taifun

The error is reported on the event :
pic

This changes the situation, because i was focussing the attention on something else. But I still don't get why this error is happening

This, with the first photo of the topic, makes the full project. Nothing else. The takepicture has an error, and from this point, am i missing some permissions?

it looks like you forgot to set the filename before taking a picture... see also the Q2 of the documentation how to set the filename starting from SDK30!

Taifun

Now the error changed, this is it now:

Attempt to invoke virtual method 'android.graphics.Bitmap android.graphics.drawable.BitmapDrawable.getBitmap()' on a null object reference

so the solution to the first problem is correct, now how i correct the second error?

Nevermind, it worked to change the "afterPicture" event like this:
pic

Many thanks to all you that helped me with this problem. Apparently updating the phone, I changed the SDK version too, so the project, that worked fine till today, had all the problems i reported.

I'm sorry if the solution was that stupid. Thanks guys.

1 Like

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