I get Cannot resolve symbol FirebaseVisionTextDetector
error when I put in my module:
import com.google.firebase.ml.vision.text.FirebaseVisionTextDetector;
I can't understand why because in gradle
I have the correct implementation:
implementation 'com.google.firebase:firebase-ml-vision:18.0.1'
SOLVED
I have solved by downgrading to 16.0.0
. Still don't know the reason why.
implementation 'com.google.firebase:firebase-ml-vision:16.0.0'
Downgrade is not really a solution. There are many bug fixes and upgrades which you should ship with your app.
FirebaseVisionTextDetector
class was removed in firebase-ml-vision:17.0.0 , it was last available in firebase-ml-vision:16.0.0 they have changed it toFirebaseVisionTextRecognizer
.
There are not much difference between both classes. So go ahead and do changes.
Changes to make:
Before (v-16.0.0):
FirebaseVisionTextDetector
FirebaseVisionTextDetector.detectInImage(image)
List<FirebaseVisionText.Block> resultsBlocks = results.getBlocks();
for (FirebaseVisionText.Block block : resultsBlocks) {
for (FirebaseVisionText.Line line : block.getLines()) {
//...
}
}
After (v-18.0.1):
FirebaseVisionTextRecognizer
FirebaseVisionTextDetector.processImage(image)
List<FirebaseVisionText.TextBlock> blocks = results.getTextBlocks();
for (FirebaseVisionText.TextBlock block : blocks) {
// ...
}
}
You can clone Official ML kit sample project to see complete code implementation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With