Google Vision很难创建TextRecognizer的实例

时间:2017-11-21 20:50:36

标签: android android-studio-3.0 google-vision

我有一个曾经与Android Studio 2一起工作的项目;现在更新到Android studio 3后,我的应用程序崩溃时达到:  TextRecognizer textRecognizer = new TextRecognizer.Builder(context).build();

你知道为什么会这样吗?

  @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    try
    {
        //here it fails
        textRecognizer = new TextRecognizer.Builder(this).build();
    }
    catch (Exception e) {
        Toast.makeText(this, e.getMessage() + " Unable to write to external storage.",
                Toast.LENGTH_LONG).show();
    }

日志:

11-25 18:21:58.042 20384-20384/? I/art: Late-enabling -Xcheck:jni
11-25 18:21:58.045 20384-20384/? I/art: Reinit property: dalvik.vm.checkjni= false
11-25 18:21:58.136 20384-20384/com.mary.pocket I/MultiDex: VM with version 2.1.0 has multidex support
11-25 18:21:58.136 20384-20384/com.mary.pocket I/MultiDex: Installing application
11-25 18:21:58.137 20384-20384/com.mary.pocket I/MultiDex: VM has multidex support, MultiDex support library is disabled.
11-25 18:21:58.209 20384-20384/com.mary.pocket I/HwCust: Constructor found for class android.app.HwCustActivityImpl
11-25 18:21:58.217 20384-20384/com.mary.pocket I/MultiDex: Installing application
11-25 18:21:58.217 20384-20384/com.mary.pocket I/MultiDex: VM has multidex support, MultiDex support library is disabled.
11-25 18:21:58.227 20384-20384/com.mary.pocket I/HwCust: Constructor found for class android.app.HwCustHwWallpaperManagerImpl
11-25 18:21:58.251 20384-20384/com.mary.pocket W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
11-25 18:21:58.262 20384-20384/com.mary.pocket W/DynamiteModule: Local module descriptor class for com.google.android.gms.vision.dynamite not found.
11-25 18:21:58.423 20384-20384/com.mary.pocket I/DynamiteModule: Considering local module com.google.android.gms.vision.dynamite:0 and remote module com.google.android.gms.vision.dynamite:1402
11-25 18:21:58.423 20384-20384/com.mary.pocket I/DynamiteModule: Selected remote version of com.google.android.gms.vision.dynamite, version >= 1402
11-25 18:21:58.484 20384-20384/com.mary.pocket W/System: ClassLoader referenced unknown path: 
11-25 18:21:58.522 20384-20384/com.mary.pocket W/System: ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/00000014/n/arm64-v8a
11-25 18:21:58.595 20384-20384/com.mary.pocket I/Vision: Loading library libocr.so
11-25 18:21:58.672 20384-20384/com.mary.pocket I/Vision: libocr.so library load status: true
11-25 18:21:58.672 20384-20384/com.mary.pocket I/Vision: Reading ocr models from /data/user/0/com.google.android.gms/app_vision/ocr/data/models
11-25 18:21:58.675 20384-20384/com.mary.pocket I/native: jni_helper.cc:166 Loading model config /data/user/0/com.google.android.gms/app_vision/ocr/data/models/semanticlift_engine_0.2.bincfg
11-25 18:21:58.675 20384-20384/com.mary.pocket E/native: jni_helper.cc:170 GetContents failed: /data/user/0/com.google.android.gms/app_vision/ocr/data/models/semanticlift_engine_0.2.bincfg
11-25 18:21:58.675 20384-20384/com.mary.pocket I/native: jni_helper.cc:166 Loading model config /data/user/0/com.google.android.gms/app_vision/ocr/data/models/tfmini_lstm_engine_latin_0.2.bincfg
11-25 18:21:58.678 20384-20384/com.mary.pocket A/native: timer.cc:38 Check failed: x >= 1 (0 vs. 1) 
11-25 18:21:58.678 20384-20384/com.mary.pocket A/native: terminating.
11-25 18:21:58.684 20384-20384/com.mary.pocket A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 20384 (com.mary.pocket)

                                                       [ 11-25 18:21:58.686   387:  387 W/         ]
                                                       debuggerd: handling request: pid=20384 uid=10209 gid=10209 tid=20384

1 个答案:

答案 0 :(得分:0)

从Google Samples github

中查看以下issue