Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot resolve symbol FirebaseVisionTextDetector

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'
like image 828
Stefano Avatar asked Dec 10 '22 04:12

Stefano


1 Answers

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 to FirebaseVisionTextRecognizer.

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.

like image 190
Khemraj Sharma Avatar answered Dec 29 '22 20:12

Khemraj Sharma