Hello everyone, i'm trying to use the barcode reader attached in this example
When i run it, in multiple device, it crash in thhe following line, while creating the detector
When i run it, in multiple device, it crash in thhe following line, while creating the detector
Sub CreateDectore:
Private Sub CreateDetector (Codes As List)
Dim ctxt As JavaObject
ctxt.InitializeContext
Dim builder As JavaObject
builder.InitializeNewInstance("com/google/android/gms/vision/barcode/BarcodeDetector.Builder".Replace("/", "."), Array(ctxt))
Dim barcodeClass As String = "com/google/android/gms/vision/barcode/Barcode".Replace("/", ".")
Dim barcodeStatic As JavaObject
barcodeStatic.InitializeStatic(barcodeClass)
Dim format As Int
For Each formatName As String In Codes
format = Bit.Or(format, barcodeStatic.GetField(formatName))
Next
builder.RunMethod("setBarcodeFormats", Array(format))
detector = builder.RunMethod("build", Null)
Dim operational As Boolean = detector.RunMethod("isOperational", Null)
If operational = False Then
toast.Show("Failed to create detector")
End If
btnStartStop.Enabled = operational
End Sub
LogError:
Error occurred on line: 122 (B4XMainPage)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.keywords.Common.CallSubDebug2(Common.java:1058)
at b4a.example.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:1069)
at b4a.example.b4xpagesmanager._showpage(b4xpagesmanager.java:426)
at b4a.example.b4xpagesmanager._addpage(b4xpagesmanager.java:246)
at b4a.example.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:260)
at b4a.example.b4xpagesmanager._initialize(b4xpagesmanager.java:166)
at b4a.example.main._activity_create(main.java:417)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:146)
at b4a.example.main.afterFirstLayout(main.java:105)
at b4a.example.main.access$000(main.java:17)
at b4a.example.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8167)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:336)
at anywheresoftware.b4a.debug.Debug.CallSubNew2(Debug.java:285)
... 24 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:318)
... 25 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:132)
at b4a.example.b4xmainpage._createdetector(b4xmainpage.java:164)
at b4a.example.b4xmainpage._b4xpage_created(b4xmainpage.java:75)
... 27 more
Caused by: com.google.android.gms.common.GooglePlayServicesMissingManifestValueException: A required meta-data tag in your app's AndroidManifest.xml does not exist. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />