Android Question after upgrade to version 12 error

mauriegio

Member
Licensed User
Longtime User
hello at all,

after uopgrade to B4a 12, and upgraded android library i have this error on debug ,
compiling is ok.

java.lang.reflect.InvocationTargetException

B4X:
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
End Sub

how can i do ?

in version 11.8 working well

thank very much

maurizio
 

mauriegio

Member
Licensed User
Longtime User
Hello thank you Erel

*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Page with this id already exists: picker!
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
Error occurred on line: 265 (B4XPickerPage)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.keywords.Common.CallSubDebug2(Common.java:1057)
at b4a.aslave.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:1072)
at b4a.aslave.b4xpagesmanager._showpage(b4xpagesmanager.java:429)
at b4a.aslave.b4xpages._showpage(b4xpages.java:33)
at b4a.aslave.b4xmainpage._butpicker_click(b4xmainpage.java:880)
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 anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:7516)
at android.view.View.performClickInternal(View.java:7493)
at android.view.View.access$3600(View.java:816)
at android.view.View$PerformClick.run(View.java:28487)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:257)
at android.app.ActivityThread.main(ActivityThread.java:8327)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:603)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
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)
 
Upvote 0
Top