其他分享
首页 > 其他分享> > android – 无法解析符号FirebaseVisionTextDetector

android – 无法解析符号FirebaseVisionTextDetector

作者:互联网

我输入模块时无法解析符号FirebaseVisionTextDetector错误:

import com.google.firebase.ml.vision.text.FirebaseVisionTextDetector;

我无法理解为什么因为在gradle中我有正确的实现:

implementation 'com.google.firebase:firebase-ml-vision:18.0.1'

解决了

我通过降级到16.0.0解决了问题.还是不知道原因.

implementation 'com.google.firebase:firebase-ml-vision:16.0.0'

解决方法:

降级并不是真正的解决方案.您的应用程序应附带许多bug fixes and upgrades.

FirebaseVisionTextDetector class was removed in
07001 , it was last available in 07002 they have changed it to FirebaseVisionTextRecognizer.

两个班级之间没有太大差异.所以继续进行改变.

要做的更改:

之前(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()) {
                //...
            }
        }

之后(v-18.0.1):

FirebaseVisionTextRecognizer
FirebaseVisionTextDetector.processImage(image)
List<FirebaseVisionText.TextBlock> blocks = results.getTextBlocks();
    for (FirebaseVisionText.TextBlock block : blocks) {
         // ...
        }
    }

您可以克隆Official ML kit sample project以查看完整的代码实现.

标签:android,firebase,firebase-mlkit
来源: https://codeday.me/bug/20190611/1215687.html