androidgoogle-vision

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


i made an app that uses Mobile Vision library to Read Text .

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

but turns out my app doesn't work with all android 4.4 versions

the " isOperational " always returns False .

here's the 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.access$800(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

UPDATE :

here's the 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 



                    }

                }
            });

        }
    }
}

i tested 4 android 4.3 and 4.4 devices and same problem . they all have a good free storage space . any idea to solve this ?


Solution

  • Update Google Play Services on your devices.

    Possibly the same problem as here: https://github.com/googlesamples/android-UniversalMusicPlayer/issues/97