TextRecognizer.isOperational() API always returns false

可紊 提交于 2021-01-03 07:14:04

问题


This question has been asked severally and only suggestions are made. Ill comprehend every suggestion hopefully.

the dependency is defined in the manifest

<meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version"/>

    <meta-data
        android:name="com.google.android.gms.vision.DEPENDENCIES"
        android:value="ocr" />

and added on the app level

compile 'com.google.android.gms:play-services-vision:9.8.0'

The test device has sufficient storage which is greater than 10% of the internal and also has a very good internet connection. Permissions are also clearly defined

We start the TextRecognizer to detect text and we get our null response:

 TextRecognizer textRecognizer = new TextRecognizer.Builder(getContext()).build();

    if (!textRecognizer.isOperational()) {

        Log.w("Main Activity", "Dependencies are not yet available");
        Toast.makeText(getContext(), "Cannot Detect", Toast.LENGTH_LONG).show();
        if(((MainActivity) getActivity()).hasLowStorage()) {
            Toast.makeText(getContext(), "Low Storage", Toast.LENGTH_LONG).show();
            Log.w("Custom_Storage", "Low Storage");
        }

    }

Most suggestions are to use a lower dependency compile 'com.google.android.gms:play-services:7.8+' but it doesn't work for everyone. After publishing the app, some users cant use the app.

The suggestions are not solving the problem.

Similar questions: TextRecognizer isOperational API always returns false and detector.isOperational() always false on android


回答1:


TextRecognizer API is required to download few dependency files. Usually it is done at the time of installation but sometimes it take longer time. App will automatically download those files. Wait some time to download those files. Until download is complete TextRecognizer.isOperational will return false. After the doanlowd is completed TextRecognizer.isOperational will return true.




回答2:


Even I had the same problem. I just created a new project and copied and installed dll again. Now it is working.



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

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