ZXing.Mobile.Forms崩溃与意外的例外

时间:2019-09-28 14:50:42

标签: xamarin.forms zxing.net

我正在使用ZXing.Mobile.Forms扫描库,并且出现以下错误 奇怪的是,它可以连续扫描,但在第四次扫描中却消失了

  

09-28 15:37:59.887 E / mono-rt(8983):[错误]致命的异常异常:Java.Lang.RuntimeException:getParameters失败(空参数)

09-28 15:37:59.887 E/mono-rt ( 8983): [ERROR] FATAL UNHANDLED EXCEPTION: Java.Lang.RuntimeException: getParameters failed (empty parameters)
09-28 15:37:59.887 E/mono-rt ( 8983):   at Java.Interop.JniEnvironment+InstanceMethods.CallObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in <f13ae3cb9fcf47aa8f3adccd03288827>:0 
09-28 15:37:59.887 E/mono-rt ( 8983):   at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0002a] in <f13ae3cb9fcf47aa8f3adccd03288827>:0 
09-28 15:37:59.887 E/mono-rt ( 8983):   at Android.Hardware.Camera.GetParameters () [0x0000a] in <3d3cf2a3639e4422aea8bb417e71ff8d>:0 
09-28 15:37:59.887 E/mono-rt ( 8983):   at ZXing.Mobile.CameraAccess.CameraController.ApplyCameraSettings () [0x00033] in <819b29aa6d91462699e19a679be55a44>:0 
09-28 15:37:59.887 E/mono-rt ( 8983):   at ZXing.Mobile.CameraAccess.CameraController.RefreshCamera () [0x00010] in <819b29aa6d91462699e19a679be55a44>:0 
09-28 15:37:59.887 E/mono-rt ( 8983):   at ZXing.Mobile.CameraAccess.CameraAnalyzer.RefreshCamera () [0x00001] in <819b29aa6d91462699e19a679be55a44>:0 
09-28 15:37:59.887 E/mono-rt ( 8983):   at ZXing.Mobile.ZXingSurfaceView.OnWindowFocusChanged (System.Boolean hasWindowFocus) [0x0008f] in <819b29aa6d91462699e19a679be55a44>:0 
09-28 15:37:59.887 E/mono-rt ( 8983):   at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.41(intptr,intptr)
09-28 15:37:59.887 E/mono-rt ( 8983):   at (wrapper native-to-managed) Android.Runtime.DynamicMethodNameCounter.41(intptr,intptr)
09-28 15:37:59.887 E/mono-rt ( 8983): --- End of stack trace from previous location where exception was thrown ---
09-28 15:37:59.887 E/mono-rt ( 8983): 

我正在使用以下内容捕获按钮单击时的扫描,这确实有效,但仅适用于前3个扫描。

public string BarCode { get; set; }

var scanPage = new ZXingScannerPage();
scanPage.ToggleTorch();
await Navigation.PushAsync(scanPage);
scanPage.OnScanResult += (result) =>
{
   // Stop scanning
   scanPage.IsScanning = false;

  // Pop the page and show the result
  Device.BeginInvokeOnMainThread(async () =>
  {
    await Navigation.PopAsync();
    BarCode = result.Text;
   }
//I call my save function here.
StockTakeTransaction stockTake = new StockTakeTransaction();
stockTake.StockTakeCountSheetItemId = item.StocktakeCountShtItemID;
stockTake.Quantity = 1;
stockTake.MobileDeviceCode = settings.DeviceID.ToString();
stockTake.WarehouseId = WarehouseId;
stockTake.MobileDeviceUser = settings.UserName.ToString();
transferList.Add(stockTake);


 SaveFunction(sender, e, stockTake);

}

此处的保存功能是通过上述方法调用的

 private async void SaveFunction(object sender, EventArgs e, StockTakeTransaction StockTakeitem)
 {
     Device.BeginInvokeOnMainThread(async () => { 
            BtnScanStockTakeItem_Clicked(sender, e); });

 }

我对api做了一些回发,所以我不在这里保留它  然后,我再次单击btn进行扫描。奇怪的是,这样的事情是经过质量检查测试才得到的

0 个答案:

没有答案