I’m implementing text recognition in my Android app using Google’s ML Kit. However, I’ve encountered a compilation error related to the getSymbols() method in the Text.Element class. I have included all the necessary imports, and according to the ML Kit documentation, the method should be available.
https://developers.google.com/android/reference/com/google/mlkit/vision/text/Text.Element#getSymbols()
// ...
for (Text.Element element: line.getElements()) {
// ...
for (Text.Symbol symbol: element.getSymbols()) {
// Access symbol properties here...
}
}
// ...
The exact error message is:
error: cannot find symbol
for (Text.Symbol symbol: element.getSymbols()) {
^
symbol: method getSymbols()
location: variable element of type Element
I expected the element.getSymbols() to work as per the documentation, which indicates that getSymbols() should return an unmodifiable list of Text.Symbol objects.
What could be causing this error, and how can I resolve it?
Salik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.