Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Text Recognition] Failed to do OCR while trying to start camera. - Android #91

Closed
SebghatYusuf opened this issue Jul 14, 2021 · 12 comments

Comments

@SebghatYusuf
Copy link
Contributor

SebghatYusuf commented Jul 14, 2021

I'm using Text Detector and Barcode Detector, I'm able to run the app on several medium & high end devices, but when I'm trying to run on low end devices, when I click on button to open camera, it just stuck to load camera and I get the bottom error:

E/flutter (18569): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: PlatformException(TextDetectorError, com.google.mlkit.common.MlKitException: Waiting for the OCR optional module to be downloaded. Please wait., null, null)


E/flutter (18569): #0      StandardMethodCodec.decodeEnvelope
package:flutter/…/services/message_codecs.dart:597
E/flutter (18569): #1      MethodChannel._invokeMethod

package:flutter/…/services/platform_channel.dart:158

E/flutter (18569): <asynchronous suspension>

E/flutter (18569): #2      TextDetector.processImage
package:google_ml_kit/…/vision/text_detector.dart:18

E/flutter (18569): <asynchronous suspension>

Any help would be highly appreciated :)

@bharat-biradar
Copy link
Collaborator

@SebghatYusuf Which version of the plugin are you using?

@SebghatYusuf
Copy link
Contributor Author

SebghatYusuf commented Jul 15, 2021

@bharat-biradar version 0.6.0

@wazini-john
Copy link

@SebghatYusuf
How did you implement the ability to download the models from google play ?

@SebghatYusuf
Copy link
Contributor Author

SebghatYusuf commented Jul 17, 2021

@wazini-john
I don't do anything, I'm just adding the package to my pubspec.yaml file and as described in Readme.md and just start using it. I don't know what other thing is necessary. can you please explain what is needed?
before when I was using firebase_ml_vision I was adding the dependencies in AndroidManifest.xml and to app/build.gradle -> dependencies

@bharat-biradar
Copy link
Collaborator

@wazini-john I have added info regarding it in the readme's android usage section please go through it once.

@bharat-biradar
Copy link
Collaborator

@SebghatYusuf Did your issue resolve, I could not find any info on minimum device spec requirements in google's original documentation, I have added a question on StackOverflow hope someone answers it.

@SebghatYusuf
Copy link
Contributor Author

SebghatYusuf commented Jul 17, 2021

@bharat-biradar
No the issue still occurs, it's not resolved yet.
Thanks for that, can you please share the StackOverflow link with me?

@SebghatYusuf
Copy link
Contributor Author

SebghatYusuf commented Jul 17, 2021

@bharat-biradar I just fixed the issue, I just needed to add this

<meta-data android:name="com.google.mlkit.vision.DEPENDENCIES" android:value="ocr" />
to AndroidManifest.xml.

But I have a doubt, why it was working on high end devices?

@SebghatYusuf SebghatYusuf changed the title [Text Recognition] Failed to do OCR while trying to start camera. [Text Recognition] Failed to do OCR while trying to start camera. - Android Jul 17, 2021
@bharat-biradar
Copy link
Collaborator

@SebghatYusuf According to the log I think it did not actually fail but the model was being downloaded, see here
PlatformException(TextDetectorError, com.google.mlkit.common.MlKitException: Waiting for the OCR optional module to be downloaded. Please wait., when you called it for the first time.

But when you added this
<meta-data android:name="com.google.mlkit.vision.DEPENDENCIES" android:value="ocr" />
The model was downloaded automatically when the app was installed and hence this error did not occur. That's what I think atleast.

@hesmnyn
Copy link

hesmnyn commented Jul 18, 2021

just added the code you said but i still get the same issue :(((

do you know anything else to help me?

@wazini-john
Copy link

@bharat-biradar I read the documentation. Just trying to find out how to prevent bundling all together coz excluding models crashes the face detection functionalities.

@bharat-biradar
Copy link
Collaborator

@wazini-john Please don't exclude model's if it's crashing. The only way to prevent the bundling altogether is to split the whole plugin into individual API's which we can't afford right now. But if you still want to reduce app size, instead of excluding the whole models try excluding one model at a time, example
models/fssd_100_8bit_v1.tflite and if not crashes it's fine otherwise you will have to keep it as it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants