Recap
On Day 7 we made an attempt to implement the camera functionality but the method await _picker.getImage(source: ImageSource.camera);
threw an error that I was unable to troubleshoot. The following error was thrown.
Exception has occurred.
PlatformException (PlatformException(no_available_camera, No cameras available for taking pictures., null, null))
Overview
In this post we'll discuss the solution to the error from Day 7.
After searching online for a solution and much frustration I found the solution in this github issue. The solution that worked for me was to change targetSdkVersion 30
to targetSdkVersion 29
. The property can be found in the android/app/build.gradle
file.
Wrap Up
As a developer, getting stuck on an error is inevitable. Fortunately, you are likely not the first person to get stuck on that error. A diligent google search e.g. github issues or stackoverflow will usually reveal a solution to the problem.
Connect with me
Thank you for reading my post. Feel free to subscribe below to join me on the #100DaysOfCodeChallenge or connect with me on LinkedIn and Twitter. You can also buy me a book to show your support.
Top comments (0)