TextRecognizer isOperational API always returns false

天大地大妈咪最大 提交于 2019-12-11 05:09:21

问题


I need to capture characters of an image so i am using TextRecognizer. My code is given below

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();

I have added dependencies in build.gradle as below:

    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'       
    }

Everytime I launch the apk, "Text recognizer could not be set up : is displayed. Even though I have set all dependencies but still i am getting this error. Please help why TextRecognizer.isOperational() is always false.

I have a project to be completed by next weekend. Please help to solve this error.


回答1:


I found answer to my question.

We need to apply the below commands in command prompt. Then issue is resolved.

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


来源:https://stackoverflow.com/questions/43383767/textrecognizer-isoperational-api-always-returns-false

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!