close

[Solved] `camera_android` threw an error: Binding has not yet been initialized

Hello Guys How are you all? Hope You all are fine. When I was trying to run my flutter app, I suddenly got the following error in my stack track: `camera_android` threw an error: Binding has not yet been initialized in a flutter. So today Here I come with all possible solutions for this error.

We are providing you with all possible solutions to solve this error. let’s start this article without wasting your time.

How `camera_android` threw an error: Binding has not yet been initialized Error Occurs?

I am using camera_android flutter plugin and I am facing the following error with this plugin.

`camera_android` threw an error: Binding has not yet been initialized

How To Solve `camera_android` threw an error: Binding has not yet been initialized Error?

  1. How To Solve `camera_android` threw an error: Binding has not yet been initialized Error?

    To Solve `camera_android` threw an error: Binding has not yet been initialized Error You just need to use dependency override in your pubspec.yaml file. First of all open pubspec.yaml file. and add both lines in dependency_overrides: camera_android: 0.9.7+1 camera_avfoundation: 0.9.7+1 Now, run flutter clean and re-run your project, and now, your error must be solved. Thank you.

  2. `camera_android` threw an error: Binding has not yet been initialized

    To Solve `camera_android` threw an error: Binding has not yet been initialized Error You need to downgrade the camera package and that worked for me. First of all delete pubspec.lock file and then Downgrade camera dependencies to the  0.9.7+1 just like this in your pubspec.yaml file: camera: ^0.9.8+1 Now Run flutter pub get and then you can run your project without error and your error is solved now.

Solution 1: Downgrade the camera package

You need to downgrade the camera package and that worked for me. First of all delete pubspec.lock file and then Downgrade camera dependencies to the  0.9.7+1 just like this in your pubspec.yaml file.

dependencies:
  camera: ^0.9.7+1

Now Run flutter pub get and then you can run your project without error and your error is solved now.

Solution 2: Use dependency override

You just need to use dependency override in your pubspec.yaml file. First of all open pubspec.yaml file. and add both lines in dependency_overrides.

dependency_overrides:
  camera_android: 0.9.7+1
  camera_avfoundation: 0.9.7+1

Now, run flutter clean and re-run your project, and now, your error must be solved. Thank you.

Conclusion

So, It’s All About This Error. I hope this tutorial helps you to Solve your error. Please Comment Below if You are stuck anywhere with my code. And please comment below on which solution worked for you. Thank You.

Also, Check Out the Below Tutorials

Leave a Comment