In this tutorial, we’ll learn how to solve the issue with Flutter build apk not working with image picker package. We’ll first see the problem, then we’ll solve it using step by step explanation.
Introduction: Flutter Build Not Working With Image Picker Package
I’ve encountered this issue while I was working in a Flutter project. There was a requirement to import pictures using the gallery and camera of an android device. So, I’ve imported the latest image picker package in my Flutter project.
Everything was working perfectly fine but when I tried to build an apk version of my Flutter app then it showed me an error and the build stopped.
It took me a alot of hours to figure out what the problem was. I’ve tried many solutions but none of them worked for me.
Finally, I found the best solution which was changing the version of image picker package.
Let’s now first see what problems we’ll face with the latest image picker package. After that, we’ll apply our solution.
Using Latest Image Picker Package Version(Problem)
Click here to get the latest image picker package from its official site. In my case, the latest package version is given below:
image_picker: ^0.8.5+3
Import it in your project’s puspec.yaml file and run (flutter pub get) in the terminal. See below image:
futter pub get
Now in the terminal, just write (flutter build apk) and click enter.
flutter build apk
We can see that it shows an error and the build stopped. Let’s now see what can we do to get rid of Flutter build apk not working with image picker issue.
Using An Old Image Picker Package Version(Solution)
In order to fix Flutter build apk not working with image picker, we’ve to use an old version of image picker package. The version is given below:
image_picker: ^0.7.5+1
Click here if you want to learn how to properly build Flutter apk and get the location of apk file.
Conclusion
To conclude this tutorial, hope you now have a complete idea of how to fix the Flutter build apk not working with image picker package. I’d love to have your feedback on this post.
I’d also love to see you visit my other tutorials on Flutter app development and Python programming as well. Thank you for reading this post.