使用Edwardvanraak条形码扫描仪库时出错

时间:2018-03-20 10:19:02

标签: android barcode barcode-scanner

我正在尝试使用Edwardvanraak库将条形码扫描仪添加到我的应用中,但是我收到了错误。

这是我的错误日志:

{
'UUID(id1)': ({'due': 'datetime.date(2018, 3, 10)', 'status': 'Done'}, 
               {'new_val': 'Pass', 'amount': 123.0}), 
'UUID(id2)': ({'due_date': 'datetime.date(2018, 3, 10)', 'old_status': 'Done'}, 
              {'new_val': 'Fail', 'amount': 0})
}

以下是我的QR码扫描代码。我尝试在新项目中添加相同的代码,它工作正常。但是我无法解决主项目中的错误:

   03-16 12:33:11.023 25919-25919/com.myapp.siva E/AndroidRuntime: FATAL EXCEPTION: main
                                                                      Process: com.myapp.siva, PID: 25919
                                                                      java.lang.IllegalAccessError: com.google.android.gms.vision.barcode.internal.client.zzd$zza
                                                                          at com.google.android.gms.vision.barcode.internal.client.zzd.zzIg(Unknown Source)
                                                                          at com.google.android.gms.vision.barcode.internal.client.zzd.<init>(Unknown Source)
                                                                          at com.google.android.gms.vision.barcode.BarcodeDetector$Builder.build(Unknown Source)
                                                                          at com.edwardvanraak.materialbarcodescanner.MaterialBarcodeScannerBuilder.buildMobileVisionBarcodeDetector(MaterialBarcodeScannerBuilder.java:237)
                                                                          at com.edwardvanraak.materialbarcodescanner.MaterialBarcodeScannerBuilder.build(MaterialBarcodeScannerBuilder.java:221)
                                                                          at com.myapp.siva.bus.QrCodeScanningActivity.startScan(QrCodeScanningActivity.java:44)
                                                                          at com.myapp.siva.bus.QrCodeScanningActivity.onCreate(QrCodeScanningActivity.java:21)
                                                                          at android.app.Activity.performCreate(Activity.java:6357)
                                                                          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
                                                                          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2408)
                                                                          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2515)
                                                                          at android.app.ActivityThread.access$1000(ActivityThread.java:154)
                                                                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1379)
                                                                          at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                          at android.os.Looper.loop(Looper.java:157)
                                                                          at android.app.ActivityThread.main(ActivityThread.java:5555)
                                                                          at java.lang.reflect.Method.invoke(Native Method)
                                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:745)
                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635)

}

我尝试解决错误,但我无法实现

1 个答案:

答案 0 :(得分:0)

请添加Google Mobile视觉依赖项,它将正常工作。

implementation 'com.google.android.gms:play-services-vision:15.0.2'