【发布时间】:2017-04-13 04:53:27
【问题描述】:
我需要捕捉图像的字符,所以我使用TextRecognizer。我的代码如下所示
TextRecognizer textRecognizer = new TextRecognizer.Builder(mActivity.getGalleryApplication().getAndroidContext()).build();
if (!textRecognizer.isOperational()) {
new AlertDialog.Builder(mActivity.getAndroidContext())
.setMessage("Text recognizer could not be set up :(").show();
return;
}
textRecognizer.release();
我在 build.gradle 中添加了如下依赖:
dependencies {
compile 'com.google.android.gms:play-services-maps:10.2.1'
compile 'com.google.firebase:firebase-appindexing:10.2.1'
compile 'com.android.support:appcompat-v7:23.0.0'
}
每次我启动 apk 时,都会显示“无法设置文本识别器:”。即使我已经设置了所有依赖项,但仍然出现此错误。请帮助为什么 TextRecognizer.isOperational() 总是错误的。
我有一个项目要在下周末之前完成。请帮忙解决这个错误。
【问题讨论】:
-
它在运行时下载其他依赖项。您的网络权限是否启用?如果是这样,你能提供你的logcat吗?当它请求其他依赖项时应该说 I/Vision 之类的内容。
-
您好,网络已启用,我已连接到 wifi。安装apk后会下载依赖吗?
-
04-13 13:38:06.767 7738 7738 I Vision:加载 libocr 库 04-13 13:38:06.769 7738 7738 I Vision:libocr 加载状态:false
-
你能告诉我为什么加载状态是错误的
标签: android ocr text-recognition