Error in firebase.mlkit.recognizeTextCloud: TypeError: Cannot read property 'android' of undefined
See original GitHub issueHi there,
When running the following code
onTextExtract() {
firebase.mlkit.textrecognition.recognizeTextCloud({
image: this.imageTaken, // a NativeScript Image or ImageSource, see the demo for examples
})
.then((result: MLKitRecognizeTextResult) => {
this.blocks = result.blocks;
})
.catch(errorMessage => console.log("ML Kit error: " + errorMessage));
}
I am getting an error in the console log:
JS: Error in firebase.mlkit.recognizeTextCloud: TypeError: Cannot read property 'android' of undefined
JS: ML Kit error: TypeError: Cannot read property 'android' of undefined
I think the error come from src/mlkit/textrecognition/index.android.ts: 106 (come.google is undefined in com.google.android.gms.tasks.OnSuccessListener).
Thank you very much for you help.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
Top Results From Across the Web
firebase cloud function error TypeError: Cannot read property ...
android - firebase cloud function error TypeError: Cannot read property 'child' of undefined - Stack Overflow. Collectives™ on Stack Overflow – ...
Read more >Recognize Text in Images with ML Kit on Android - Firebase
This page describes an old version of the Text Recognition API, which was part of ML Kit for Firebase. The functionality of this...
Read more >nativescript-firebase-updated-new - npm
Start using nativescript-firebase-updated-new in your project by running `npm i ... There are no other projects in the npm registry using ...
Read more >Migrating for iOS | ML Kit - Google Developers
You can't mix frameworks and cocoapods, so in order to use this library you need to first migrate to use cocoapods. Update Cocoapods....
Read more >Text Detector in Android using Firebase ML Kit - GeeksforGeeks
We have seen many apps that detect text from any image. This image may include number plates, images, and many more. In this...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This response is pretty late and you have probably already found an answer, but here’s something that could help others who encounter the same issue. I did not solve the issue by removing another plugin. The property ‘android’ is actually part of NativeScript ImageSource, so this was probably set up incorrectly. Here is how to set it up correctly with TypeScript. First, you need to import ImageSource:
import { ImageSource, fromFile } from "tns-core-modules/image-source";
Next, set your ImageSource to whatever image you want to scan using the firebase recognize text. This is just the path that I have for my project so this will look different for yours.
let localImage: ImageSource = fromFile('~/assets/image/image.jpg');
And then put it into the text recognize method. Here’s what mine looks like for reference:
private runTextRecognition(){
let localImage: ImageSource = fromFile('~/assets/image/scorecard1.jpg');
this.firebase.mlkit.textrecognition.recognizeTextOnDevice({
image: localImage
}).then((result: MLKitRecognizeTextResult) => {
console.log(result.text ? result.text : "");
}).catch(errorMessage => console.log("ML Kit error: " + errorMessage));
}
Me too. Please report if you found the plugin interfering with this issue