Camera component not working

Hi, I am testing the camera component in a very simple app with a button and an image component.
As soon as I click the button I get an error like the one in the image attached.

I tested the camera component in App Inventor 2 and it works normally.

Camera blocks

2 Likes

To be more precise, when I first run the app I get a message to allow it to take pictures and record videos, to which I respond ‘allow’, but I immediately get the error ’ app has stopped - Open app again’.
When I open the app again and click on the button to take a picture I get the error message ‘Runtime Error Attempt to invoke virtual method …’ .
Oddly enough, when I test the app with companion it works normally!!!?


I am facing same problem, works perfect
with companion,

after apk install does not works.

2 Likes

I’m facing same problem with camera component

1 Like

Yes same here…

1 Like

@archet
@Roshan_Hemrajani
@saddam_horti786
@unveryalincak
which Android version are you using for your tests?

in case this is Android 10, see here

Taifun

Mine is version 8.0.0

something for @Kodular to look at
Taifun

Version Android 10

mine is 8.1.0

The camera component no longer requests WRITE permission automatically (it’s a bug). You have to ask for it manually:
grafik
Note : WRITE_EXTERNAL_STORAGE is sufficient as it implicitly grants READ permission. So no need to ask for READ permission.

@archet
@Roshan_Hemrajani
@saddam_horti786
@unveryalincak

https://docs.kodular.io/components/media/camera/

4 Likes

Unfortunately it did not work for me.
Before this I was looking at the app permissions on Android settings and found it has camera and storage permissions, so it should work, but unfortunately it doesn’t. :thinking: :frowning_face:

still not working.

Does this work for you CamTest2.apk (4.8 MB)

2 Likes

If you have not asked for WRITE permission manually, the app has no storage permission (on devices with API ≥ 23, Android ≥ 6).

So try this APK (withou asking for WRITE perm.): camera.apk (4.8 MB)
and this (with manually asking for WRITE): cameraTest2.apk (4.8 MB)

or this:

3 Likes

At this point I am lost!
I tried all of three apps (camera, cameraTest2 and CamTest2) and they work normally, but when I write a simple test app with a button and a camera component and ask for permission “WRITE_EXTERNAL_STORAGE”, the app doesn’t work. (???)
May I have or see the .aia files of the apps?

I fixed missing permission request and else local.
We have to verify now that it works.
Then we can release the fix soon.

I suggest you post your aia or the blocks so we can tell you where your problem is.

Unfortunately it did not work for me too.

Hello,

i have the same problem and tried the examples. (Android 9)

  • camera.apk --> can take pictures but they don’t show on screen1
  • cameraTest2.apk --> can take pictures an the picture shown on screen1
  • CamTest2.apk --> same as cameraTest2.apk

I tried to recreate the example but it doesn’t work, the same runtime error as in the first post. Am I doing something wrong?

Here are my blocks: