android 4.4 版设备不适用于 google 的移动视觉,isOperational returns false

android version 4.4 devices doesn't work with google's mobile vision , isOperational returns false

我制作了一个使用移动视觉库来阅读文本的应用程序。

compile 'com.google.android.gms:play-services:11.0.4'

但事实证明我的应用程序不适用于所有 android 4.4 版本

“isOperational”总是returns False。

这是 logcat :

    E/TextNativeHandle: Error creating remote native handle
com.google.android.gms.dynamite.DynamiteModule$zzc: No acceptable module found. Local version is 0 and remote version is 0.
at com.google.android.gms.dynamite.DynamiteModule.zza(Unknown Source)
at com.google.android.gms.internal.fb.zzDR(Unknown Source)
at com.google.android.gms.internal.fb.isOperational(Unknown Source)
at com.google.android.gms.vision.text.TextRecognizer.isOperational(Unknown Source)
at MY_PACKAGE_NAME.ReadingActivity.onCreate(ReadingActivity.java:101)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access0(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
09-26 16:24:24.185 2365-2365/MY_PACKAGE_NAME E/ActivityThread: Failed to find provider info for com.google.android.gms.chimera

更新:

这是 ReadingActivity class:

public class ReadingActivity extends AppCompatActivity {   


    private SurfaceView camView;

    private CameraSource camSource;

  @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_reading);


     camView = (SurfaceView) findViewById(R.id.scnView);

TextRecognizer txtRecognizer = new TextRecognizer.Builder(getApplicationContext()).build();

if (!txtRecognizer.isOperational()) {

            // showing an error message 
            Toast.makeText(this ,"FALSE" ,Toast.LENGTH_SHORT).show();


        } else {


            camSource = new CameraSource.Builder(getApplicationContext(), txtRecognizer)
                    .setFacing(CameraSource.CAMERA_FACING_BACK)
                    .setAutoFocusEnabled(true)
                    .setRequestedPreviewSize(1280,1024)
                    .setRequestedFps(2.0f)
                    .build();

            //  starting cam view
            camView.getHolder().addCallback(new SurfaceHolder.Callback() {
                @Override
                public void surfaceCreated(SurfaceHolder surfaceHolder) {

                    try {

                        // check if permissions is granted
                        if (ActivityCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {

                            return;
                        }
                        // starting the camera
                        camSource.start(camView.getHolder());
                        // starting the focus on touch method
                        initCameraFocusListener();

                    } catch (Exception e) {

                        e.printStackTrace();
                    }
                }

                @Override
                public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i1, int i2) {

                }

                @Override
                public void surfaceDestroyed(SurfaceHolder surfaceHolder) {

                    camSource.stop();
                }
            });


            txtRecognizer.setProcessor(new Detector.Processor<TextBlock>() {
                @Override
                public void release() {

                }

                @Override
                public void receiveDetections(Detector.Detections<TextBlock> detections) {

                   final SparseArray<TextBlock> items = detections.getDetectedItems();

                    if (items.size() != 0) {


                       /// dealing with the results here 



                    }

                }
            });

        }
    }
}

我测试了 4 android 4.3 和 4.4 设备,同样的问题。 他们都有很好的免费存储 space 。 有解决这个问题的想法吗?

在您的设备上更新 Google Play 服务。

可能与这里的问题相同:https://github.com/googlesamples/android-UniversalMusicPlayer/issues/97