0

Although i took the code from firebase console and i'm pretty sure the firebase is properly integrated

FirebaseVisionImage image = FirebaseVisionImage.fromBitmap(bitmap);
    FirebaseVisionTextRecognizer detector = FirebaseVision.getInstance()
            .getOnDeviceTextRecognizer();


    Task<FirebaseVisionText> result =
            detector.processImage(image)
                    .addOnSuccessListener(new OnSuccessListener<FirebaseVisionText>() {
                        @Override
                        public void onSuccess(FirebaseVisionText firebaseVisionText) {
                            // Task completed successfully
                            // ...

                            Toast.makeText(MainActivity.this, "Inn On Success Method", Toast.LENGTH_SHORT).show();
                        }
                    })
                    .addOnFailureListener(
                            new OnFailureListener() {
                                @Override
                                public void onFailure(@NonNull Exception e) {
                                    // Task failed with an exception
                                    // ...

                                    Toast.makeText(MainActivity.this, "Inn On failure Method", Toast.LENGTH_SHORT).show();
                                }
                            });

I added the toast messages just to check which method is executed.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • ML Kit passes an `Exception` into `onFailure`, which probably gives a pretty good idea of what's going wrong. So you should print the error: `System.out.println(e.toString())` and then find the message in your logcat output. – Frank van Puffelen Mar 21 '19 at 13:40
  • Hi thanks for your answer. The exception says 'Waiting for the text recognition model to be downloaded. Please wait'. I waited for so long and rebuilt the project so many times but the exception stays same. Can you help me with this? – Alina Baig Mar 21 '19 at 14:36
  • Search for that error message gives a lot of relevant results: https://www.google.com/search?q=ML+Kit+Waiting+for+the+text+recognition+model+to+be+downloaded.+Please+wait – Frank van Puffelen Mar 21 '19 at 17:40

0 Answers0