ZXing не будет работать на Vuzix M300, но он работает на Samsung S9 - PullRequest
0 голосов
/ 14 марта 2019

Я пытаюсь сделать сканер штрих-кода / QR, используя библиотеку ZXing.Если я запускаю это приложение на своем Samsung S9, оно работает.Когда я запускаю его на Vuzix M300, он не работает.Я попытался запустить демо-приложение с ZXing на Vuzix, и это работает.Мой код следующий:

package com.example.scanner;

import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import com.google.zxing.Result;

import me.dm7.barcodescanner.zxing.ZXingScannerView;

public class MainActivity extends AppCompatActivity implements 
    ZXingScannerView.ResultHandler {
    private ZXingScannerView zXingScannerView;
    ViewGroup fl;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        fl = (ViewGroup) findViewById(R.id.fl);
        zXingScannerView = new ZXingScannerView(this);
        fl.addView(zXingScannerView);
    }

    @Override
    public void onResume() {
        super.onResume();
        zXingScannerView.setResultHandler(this);
        // You can optionally set aspect ratio tolerance level
        // that is used in calculating the optimal Camera preview size
        //zXingScannerView.setAspectTolerance(10f);
        zXingScannerView.startCamera();
    }

    public void scan(View view) {

    }

    @Override
    protected void onPause() {
        super.onPause();
        zXingScannerView.stopCamera();
    }

    @Override
    public void handleResult(Result rawResult) {
        Toast.makeText(this,rawResult.getText(), Toast.LENGTH_LONG).show();
        Log.e("scan", rawResult.getText());
        Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
            zXingScannerView.resumeCameraPreview(MainActivity.this);
            }
        }, 20000);
    }
}

Камера открывается на Vuzix M300, но ничего не сканирует.Похоже, что камера увеличена, если сравнить ее с демонстрационным приложением.

Logcat на Vuzix выглядит следующим образом:

03-18 09:30:49.324 2018-2018/? I/art: Late-enabling -Xcheck:jni
03-18 09:30:49.345 2018-2024/? I/art: Debugger is no longer active
03-18 09:30:49.407 2018-2018/? W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,sse4.1,sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.example.scanner-2/split_lib_dependencies_apk.apk --oat-file=/data/dalvik-cache/x86/data@app@com.example.scanner-2@split_lib_dependencies_apk.apk@classes.dex) because non-0 exit status
03-18 09:30:49.583 2018-2018/? W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,sse4.1,sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.example.scanner-2/split_lib_slice_0_apk.apk --oat-file=/data/dalvik-cache/x86/data@app@com.example.scanner-2@split_lib_slice_0_apk.apk@classes.dex) because non-0 exit status
03-18 09:30:49.617 2018-2018/? W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,sse4.1,sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.example.scanner-2/split_lib_slice_1_apk.apk --oat-file=/data/dalvik-cache/x86/data@app@com.example.scanner-2@split_lib_slice_1_apk.apk@classes.dex) because non-0 exit status
03-18 09:30:49.651 2018-2018/? W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,sse4.1,sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.example.scanner-2/split_lib_slice_2_apk.apk --oat-file=/data/dalvik-cache/x86/data@app@com.example.scanner-2@split_lib_slice_2_apk.apk@classes.dex) because non-0 exit status
03-18 09:30:49.689 2018-2018/? W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,sse4.1,sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.example.scanner-2/split_lib_slice_3_apk.apk --oat-file=/data/dalvik-cache/x86/data@app@com.example.scanner-2@split_lib_slice_3_apk.apk@classes.dex) because non-0 exit status
03-18 09:30:49.725 2018-2018/? W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,sse4.1,sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.example.scanner-2/split_lib_slice_4_apk.apk --oat-file=/data/dalvik-cache/x86/data@app@com.example.scanner-2@split_lib_slice_4_apk.apk@classes.dex) because non-0 exit status
03-18 09:30:49.757 2018-2018/? W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,sse4.1,sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.example.scanner-2/split_lib_slice_5_apk.apk --oat-file=/data/dalvik-cache/x86/data@app@com.example.scanner-2@split_lib_slice_5_apk.apk@classes.dex) because non-0 exit status
03-18 09:30:49.789 2018-2018/? W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,sse4.1,sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.example.scanner-2/split_lib_slice_6_apk.apk --oat-file=/data/dalvik-cache/x86/data@app@com.example.scanner-2@split_lib_slice_6_apk.apk@classes.dex) because non-0 exit status
03-18 09:30:49.821 2018-2018/? W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,sse4.1,sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.example.scanner-2/split_lib_slice_7_apk.apk --oat-file=/data/dalvik-cache/x86/data@app@com.example.scanner-2@split_lib_slice_7_apk.apk@classes.dex) because non-0 exit status
03-18 09:30:49.858 2018-2018/? W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,sse4.1,sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.example.scanner-2/split_lib_slice_8_apk.apk --oat-file=/data/dalvik-cache/x86/data@app@com.example.scanner-2@split_lib_slice_8_apk.apk@classes.dex) because non-0 exit status
03-18 09:30:49.896 2018-2018/? W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,sse4.1,sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.example.scanner-2/split_lib_slice_9_apk.apk --oat-file=/data/dalvik-cache/x86/data@app@com.example.scanner-2@split_lib_slice_9_apk.apk@classes.dex) because non-0 exit status
03-18 09:30:49.898 2018-2018/? W/System: ClassLoader referenced unknown path: /data/app/com.example.scanner-2/lib/x86
03-18 09:30:49.901 2018-2018/? I/InstantRun: starting instant run server: is main process
03-18 09:30:49.986 2018-2018/? 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
03-18 09:30:50.051 2018-2018/? I/art: Rejecting re-init on previously-failed class java.lang.Class<android.support.v4.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>
03-18 09:30:50.051 2018-2018/? I/art: Rejecting re-init on previously-failed class java.lang.Class<android.support.v4.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>
03-18 09:30:50.179 2018-2064/? D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
03-18 09:30:50.219 2018-2064/? I/OpenGLRenderer: Initialized EGL, version 1.4
03-18 09:30:50.220 2018-2064/? W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
03-18 09:30:50.278 2018-2018/? W/art: Before Android 4.1, method int android.support.v7.widget.DropDownListView.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView

Если я пытаюсь что-то сканировать, ничего не происходитпоказано в logcat vuzix.

...