rebuy-de / rb-forms-barcode

Rb.Forms.Barcode is a Xamarin.Forms view for scanning barcodes.
https://github.com/rebuy-de/rb-forms-barcode
MIT License
43 stars 21 forks source link

CameraSource.TakePicture is failing to take picture sometime #66

Closed yogeshcprajapati closed 7 years ago

yogeshcprajapati commented 7 years ago

03-02 13:37:05.607 E/mono (13058): Unhandled Exception: 03-02 13:37:05.607 E/mono (13058): Java.Lang.RuntimeException: takePicture failed 03-02 13:37:05.607 E/mono (13058): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 03-02 13:37:05.607 E/mono (13058): at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue args) [0x00084] in /Users/builder/data/lanes/4009/9578cdcd/source/Java.Interop/src/Java.Interop/Java.Interop/JniEnvironment.g.cs:11643 03-02 13:37:05.607 E/mono (13058): at Android.Runtime.JNIEnv.CallVoidMethod (System.IntPtr jobject, System.IntPtr jmethod, Android.Runtime.JValue parms) [0x00000] in /Users/builder/data/lanes/4009/9578cdcd/source/monodroid/src/Mono.Android/JNIEnv.g.cs:264 03-02 13:37:05.607 E/mono (13058): at Com.Rebuy.Play.Services.Vision.CameraSource.TakePicture (Com.Rebuy.Play.Services.Vision.CameraSource+IShutterCallback p0, Com.Rebuy.Play.Services.Vision.CameraSource+IPictureCallback p1) [0x0006f] in C:\rb-forms-barcode-master\CameraSourceBindings\obj\Debug\generated\src\Com.Rebuy.Play.Services.Vision.CameraSource.cs:1143 03-02 13:37:05.607 E/mono (13058): at Rb.Forms.Barcode.Droid.View.TakePictureCallback+d2.MoveNext () [0x00019] in C:\rb-forms-barcode-master\Rb.Forms.Barcode.Droid\View\TakePictureCallback.cs:30 03-02 13:37:05.607 E/mono (13058): --- End of stack trace from previous location where exception was thrown --- 03-02 13:37:05.607 E/mono (13058): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 03-02 13:37:05.607 E/mono (13058): at System.Runtime.CompilerServices.AsyncMethodBuilderCore.m1 (System.Object state) [0x00000] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1034 03-02 13:37:05.607 E/mono (13058): at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) [0x0000e] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:1304 03-02 13:37:05.607 E/mono (13058): at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x0008d] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:957 03-02 13:37:05.607 E/mono (13058): at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:904 03-02 13:37:05.607 E/mono (13058): at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x0002a] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:1281 03-02 13:37:05.607 E/mono (13058): at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00096] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:854 03-02 13:37:05.607 E/mono (13058): at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:1209 03-02 13:37:05.607 E/mono (13058): --- End of managed Java.Lang.RuntimeException stack trace --- 03-02 13:37:05.607 E/mono (13058): java.lang.RuntimeException: takePicture failed 03-02 13:37:05.607 E/mono (13058): at android.hardware.Camera.native_takePicture(Native Method) 03-02 13:37:05.607 E/mono (13058): at android.hardware.Camera.takePicture(Camera.java:1434) 03-02 13:37:05.607 E/mono (13058): at com.rebuy.play.services.vision.CameraSource.takePicture(CameraSource.java:474) 03-02 13:37:05.607 E/mono (13058):

fvermeulen commented 7 years ago

@yogeshcprajapati Can you give us more details, how do you get the error?

What device do you used? Which android version? Which google playservices version? etc

yogeshcprajapati commented 7 years ago

@fvermeulen I have managed to solved it. If we call TakePicture method under separate task then it is working fine. Below is the working code. System.Threading.Tasks.Task.Run(() => { cameraSource.TakePicture(.......); }

Sorry for wrong reporting...