'flutter app release apk does not open camera

I have a flutter app which uses the phone's camera. While debugging I can successfully use the camera but when using a release apk I have built I get a blank screen. I have added the permissions to the manifest and also the app requests for user to grant permission too.

Here is how it looks in debug mode

Debug Screenshot

Here is how it looks when I install app-release.apk

Release screenshot

What could be the issue?



Solution 1:[1]

I think you need

flutter clean

(I'd consider it a bug that this is necessary, but I'm encountering it as well) and

flutter build apk --release

Solution 2:[2]

Did you ask the user for permission? If not the system will block all camera requests

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Awais Rehman
Solution 2 Lau Dijksterhuis