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

com.google.mlkit.vision.text.TextRecognizer Error when run "flutter build appbundle" #744

Open
salar-dev opened this issue Feb 10, 2025 · 2 comments
Labels
Text Recognition Issues corresponding to Text Recognition API

Comments

@salar-dev
Copy link

Describe your issue. If applicable, add screenshots to help explain your problem.

I face Issue when run flutter build appbundle
when I use "google_mlkit_text_recognition"

I
This error

flutter build appbundle

Font asset "FlutterIconsax.ttf" was tree-shaken, reducing it from 670228 to 1924 bytes (99.7% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 6368 bytes (99.6% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in /Volumes/SanDisk/projects/Client Projects/websites/Istikbal_order_manegar/app/flutter/istkbal_order_manager/build/app/outputs/mapping/release/missing_rules.txt.
ERROR: R8: Missing class com.google.mlkit.vision.text.chinese.ChineseTextRecognizerOptions$Builder (referenced from: com.google.mlkit.vision.text.TextRecognizer com.google_mlkit_text_recognition.TextRecognizer.initialize(io.flutter.plugin.common.MethodCall))
Missing class com.google.mlkit.vision.text.chinese.ChineseTextRecognizerOptions (referenced from: com.google.mlkit.vision.text.TextRecognizer com.google_mlkit_text_recognition.TextRecognizer.initialize(io.flutter.plugin.common.MethodCall))
Missing class com.google.mlkit.vision.text.devanagari.DevanagariTextRecognizerOptions$Builder (referenced from: com.google.mlkit.vision.text.TextRecognizer com.google_mlkit_text_recognition.TextRecognizer.initialize(io.flutter.plugin.common.MethodCall))
Missing class com.google.mlkit.vision.text.devanagari.DevanagariTextRecognizerOptions (referenced from: com.google.mlkit.vision.text.TextRecognizer com.google_mlkit_text_recognition.TextRecognizer.initialize(io.flutter.plugin.common.MethodCall))
Missing class com.google.mlkit.vision.text.japanese.JapaneseTextRecognizerOptions$Builder (referenced from: com.google.mlkit.vision.text.TextRecognizer com.google_mlkit_text_recognition.TextRecognizer.initialize(io.flutter.plugin.common.MethodCall))
Missing class com.google.mlkit.vision.text.japanese.JapaneseTextRecognizerOptions (referenced from: com.google.mlkit.vision.text.TextRecognizer com.google_mlkit_text_recognition.TextRecognizer.initialize(io.flutter.plugin.common.MethodCall))
Missing class com.google.mlkit.vision.text.korean.KoreanTextRecognizerOptions$Builder (referenced from: com.google.mlkit.vision.text.TextRecognizer com.google_mlkit_text_recognition.TextRecognizer.initialize(io.flutter.plugin.common.MethodCall))
Missing class com.google.mlkit.vision.text.korean.KoreanTextRecognizerOptions (referenced from: com.google.mlkit.vision.text.TextRecognizer com.google_mlkit_text_recognition.TextRecognizer.initialize(io.flutter.plugin.common.MethodCall))

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:minifyReleaseWithR8'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.R8Task$R8Runnable
   > Compilation failed to complete

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 32s
Running Gradle task 'bundleRelease'...                             33.2s
Gradle task bundleRelease failed with exit code 1

Steps to reproduce.

flutter build appbundle

ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in /Volumes/SanDisk/projects/Client Projects/websites/Istikbal_order_manegar/app/flutter/istkbal_order_manager/build/app/outputs/mapping/release/missing_rules.txt.

What is the expected result?

Build appbundle without any Issues

Did you try our example app?

No

Is it reproducible in the example app?

No

Reproducible in which OS?

Android

Flutter/Dart Version?

Flutter (Channel stable, 3.27.4)

Plugin Version?

google_mlkit_text_recognition: ^0.14.0

@Nanthigna
Copy link

I resolved the issue for the Android platform by adding below block to the android/app/build.gradle file:

dependencies {
// Add language package you need to use
implementation 'com.google.mlkit:text-recognition-chinese:16.0.0'
implementation 'com.google.mlkit:text-recognition-devanagari:16.0.0'
implementation 'com.google.mlkit:text-recognition-japanese:16.0.0'
implementation 'com.google.mlkit:text-recognition-korean:16.0.0'
}

@salar-dev
Copy link
Author

@Nanthigna
Yes this work for me also.

@bensonarafat bensonarafat added the Text Recognition Issues corresponding to Text Recognition API label Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Text Recognition Issues corresponding to Text Recognition API
Projects
None yet
Development

No branches or pull requests

3 participants