Closed kronnakrit closed 6 years ago
UPDATE: I tried using this library in a fresh start project with same exact rn and react version as in my current project, and it worked perfectly (way faster than react-native-camera). So, I don't know what is wrong with my current project yet.
UPDATE: Apparently, this library doesn't work with some other libraries such as react-native-push-notification, react-native-device-info, react-native-google-signin.
Hey @zorosun, did you investigate whether the compatibility problem was in this library, or could it be that some of the other one's aren't a great fit for camera-based apps? What was the conclusion?
+1
@ekreutz I found that this library does't work with some other libraries. This library works with the latest version of RN, but I have no idea why it doesn't with other libraries. I didn't investigate further since I was short on time so I have changed to other library instead. I have been using other libraries with react-native-camera and, currently, react-native-barcodescanner. Is anyone encounter the same problem?
I have moved to react-native-smart-barcode, it is also works fine with ios.
I had the same problem but I successfully solved it.
The error was the same but it covered exception:
com.google.android.gms.vision.barcode.internal.client.zzd.zzIg ()
com.google.android.gms.vision.barcode.internal.client.zzd.<init> ()
com.google.android.gms.vision.barcode.BarcodeDetector$Builder.build ()
com.ekreutz.barcodescanner.ui.BarcodeScannerView.createBarcodeDetector (BarcodeScannerView.java:268)
com.ekreutz.barcodescanner.ui.BarcodeScannerView.createCameraSource (BarcodeScannerView.java:244)
com.ekreutz.barcodescanner.ui.BarcodeScannerView.start (BarcodeScannerView.java:158)
com.ekreutz.barcodescanner.ui.BarcodeScannerView.onAttachedToWindow (BarcodeScannerView.java:147)
android.view.View.dispatchAttachedToWindow (View.java:13716)
android.view.ViewGroup.dispatchAttachedToWindow (ViewGroup.java:2815)
android.view.ViewGroup.dispatchAttachedToWindow (ViewGroup.java:2822)
android.view.ViewGroup.addViewInner (ViewGroup.java:4105)
android.view.ViewGroup.addView (ViewGroup.java:3916)
com.facebook.react.views.view.ReactViewGroup.addView (ReactViewGroup.java:389)
android.view.ViewGroup.addView (ViewGroup.java:3857)
com.facebook.react.views.view.ReactViewManager.addView (ReactViewManager.java:209)
com.facebook.react.views.view.ReactViewManager.addView (ReactViewManager.java:41)
com.facebook.react.uimanager.NativeViewHierarchyManager.manageChildren (NativeViewHierarchyManager.java:395)
com.facebook.react.uimanager.UIViewOperationQueue$ManageChildrenOperation.execute (UIViewOperationQueue.java:177)
com.facebook.react.uimanager.UIViewOperationQueue$1.run (UIViewOperationQueue.java:776)
com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches (UIViewOperationQueue.java:855)
com.facebook.react.uimanager.UIViewOperationQueue.access$1600 (UIViewOperationQueue.java:46)
com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded (UIViewOperationQueue.java:900)
com.facebook.react.uimanager.GuardedFrameCallback.doFrame (GuardedFrameCallback.java:31)
com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame (ReactChoreographer.java:136)
com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame (ChoreographerCompat.java:107)
android.view.Choreographer$CallbackRecord.run (Choreographer.java:798)
android.view.Choreographer.doCallbacks (Choreographer.java:603)
android.view.Choreographer.doFrame (Choreographer.java:571)
android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:786)
android.os.Handler.handleCallback (Handler.java:815)
android.os.Handler.dispatchMessage (Handler.java:104)
android.os.Looper.loop (Looper.java:194)
android.app.ActivityThread.main (ActivityThread.java:5651)
java.lang.reflect.Method.invoke (Method.java)
java.lang.reflect.Method.invoke (Method.java:372)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:959)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:754)
After some digging into it I found that it was because google vision was not ready on device.
If you add into android/app/build.gradle
:
compile 'com.google.android.gms:play-services-vision:11.0.4'
it should solve the problem. If you still got an error try add prop onException
as in advanced example in readme.
@ekreutz maybe it is worth of mentioning in readme?
@ddeath do you feel as if this could have been avoided using onException
?
Some situations like this are exactly the reason why you want to catch those exceptions JS-side
@ekreutz not sure. I do not know what happens if you do not include play-services-vision in your build.gradle.
Will the app download it in runtime? Anyway I think that play-services-vision should be mentioned in readme as dependency.
@ddeath I got it working with your suggestion. thx
I get same error but @ddeath is not working for me
React-native version: 0.53.3
@IvanCoronado Have you solved the problem?
I get same error with my current project. I tried with new project and works. How to solve this?
I got a clue, this problem occured after I upgraded Sdk version to 26
@ddeath i have done the same but not working
When I tried to navigate to BarcodeScanner view, the app will crash with the error 'Attempted to RESUME barcode scanner before scanner view was instantiated.'. Does this library support current version of react native or is it just me doing something wrong ?
react native version: 0.44.2