TextRecognizer isOperational API 始终返回 false



我需要捕获图像的字符,所以我正在使用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()总是错误的。

我有一个项目要在下周末完成。请帮助解决此错误。

我找到了问题的答案。

我们需要在命令提示符下应用以下命令。然后问题得到解决。

adb root
adb remount
adb shell setenforce 0  it will disable SE policy 
adb remount

最新更新