skip to Main Content

I am currently making a basic google lens app and I’m struggling with this error. Is there a way to fix this?

My dependencies:

dependencies {

    implementation 'androidx.appcompat:appcompat:1.4.0'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
    implementation 'com.google.firebase:firebase-ml-vision:25.1.0'
    implementation 'com.google.firebase:firebase-core:20.0.2'
    implementation 'com.google.firebase:firebase-ml-vision-image-label-mode:20.0.1'
    implementation 'com.android.volley:volley:1.2.1'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

The coding(image link is under the coding):

private void getResults(){
    FirebaseVisionImage image = FirebaseVisionImage.fromBitmap(imageBitmap);
    FirebaseVisionImageLabeler labeler = FirebaseVision.getInstance().getOnDeviceImageLabeler();

    labeler.processImage(image).addOnSuccessListener(new OnSuccessListener<>());

https://i.stack.imgur.com/KvZhi.png

I would be really appreciated for your advice and help, thank you.

2

Answers


  1. Chosen as BEST ANSWER

    If you had this error like i did, Go to Tools, select Firebase, go to Firebase ML click "Use Firebase ML to recognize and labels images". Connect to Firebase and Add Firebase ML to your app. You can also choose the second option "text in images" if you want to


  2. Do you have the proper imports in your file? The FirebaseVisionImage object exists at com.google.firebase.ml.vision.common.FirebaseVisionImage as documented here.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search