I have a Flutter project in which I am trying to put MLKit for text OCR. I have crated a standalone Flutter project which works fine with MLKit. However when I put the same code and dependencies to my existing Flutter project it is not working as expected.
Below are the issues I am getting when trying to choosing the image...
When I click on the gallery to choose the image it throws exception.
final file = await ImagePicker.pickImage(source: imageSource); if (file == null) { throw Exception('File is not available'); }
When I am trying to choose camera it asks for the permission for the first time and then app gets closed.... throws " java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference"
Once these exceptions thrown every subsequent tries it throws exception "PlatformException(already_active, image picker is already active, null)"
cupertino_icons: ^0.1.2 firebase_auth: ^0.8.0+1 cloud_firestore: ^0.9.0 firebase_core: ^0.3.0 intl_translation: ^0.17.2 firebase_messaging: ^3.0.0 http: ^0.12.0+1 xml: ^3.3.1 firebase_storage: ^2.0.0 uuid: ^1.0.3 shared_preferences: ^0.5.0 flutter_staggered_grid_view: ^0.2.7 google_sign_in: ^4.0.0 flutter_signin_button: ^0.2.5 mlkit: ^0.9.0 path_provider: ^0.5.0+1 image_picker: ^0.5.0+3
I have followed below blog in order to implement MLKit https://medium.com/flutter-community/flutter-text-barcode-scanner-app-with-firebase-ml-kit-103db6b6dad7
Thank you