Android Question [B4X] [B4XPages] Barcode Reader - ERROR

james_sgp

Active Member
Licensed User
Longtime User
I`m getting an error running Erel's example, at line the following line in the 'Createdetector' routine, would appreciate any advice...

B4X:
detector = builder.RunMethod("build", Null)

Log:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 123 (B4XMainPage)
java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:132)
    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:348)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
    at b4a.example.b4xmainpage._b4xpage_created(b4xmainpage.java:55)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:318)
    at anywheresoftware.b4a.debug.Debug.CallSubNew2(Debug.java:285)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.keywords.Common.CallSubDebug2(Common.java:1058)
    at b4a.example.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:1061)
    at b4a.example.b4xpagesmanager._showpage(b4xpagesmanager.java:418)
    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:144)
    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:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:246)
    at android.app.ActivityThread.main(ActivityThread.java:8653)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
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" />
    at com.google.android.gms.common.GooglePlayServicesUtilLight.isGooglePlayServicesAvailable(com.google.android.gms:play-services-basement@@18.1.0:8)
    at com.google.android.gms.common.GoogleApiAvailabilityLight.isGooglePlayServicesAvailable(com.google.android.gms:play-services-basement@@18.1.0:2)
    at com.google.android.gms.dynamite.DynamiteModule.zzf(com.google.android.gms:play-services-basement@@18.1.0:6)
    at com.google.android.gms.dynamite.DynamiteModule.zza(com.google.android.gms:play-services-basement@@18.1.0:8)
    at com.google.android.gms.dynamite.zze.zzb(com.google.android.gms:play-services-basement@@18.1.0:1)
    at com.google.android.gms.dynamite.zzk.selectModule(com.google.android.gms:play-services-basement@@18.1.0:2)
    at com.google.android.gms.dynamite.DynamiteModule.load(com.google.android.gms:play-services-basement@@18.1.0:5)
    at com.google.android.gms.internal.vision.zzt.zzd(com.google.android.gms:play-services-vision-common@@19.1.3:24)
    at com.google.android.gms.internal.vision.zzm.<init>(com.google.android.gms:play-services-vision@@20.1.3:3)
    at com.google.android.gms.vision.barcode.BarcodeDetector$Builder.build(com.google.android.gms:play-services-vision@@20.1.3:7)
    ... 37 more
Message longer than Log limit (4000). Message was truncated.
 

Johan Schoeman

Expert
Licensed User
Longtime User
Is your manifest correct:

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" />
 
Upvote 0

Xfood

Expert
Licensed User
add this in the manifest


AddApplicationText(
<meta-data android:name="com.google.android.gms.version" android:value="@Integer/google_play_services_version" />
)
 
Upvote 0

james_sgp

Active Member
Licensed User
Longtime User
I`m running the example as is...
 
Upvote 0

james_sgp

Active Member
Licensed User
Longtime User
Downloaded a fresh copy, get a warning as it's using 'Target=29', but don`t change. Still get the same error...

I`m running B4A 11.50, no SDKs are showing to install.
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
no SDKs are showing to install.
That's sounds worrying because it means that you have probably run SDK Manager which is normally totally unnecessary and can cause problems if you do. The installation instructions explicitly warn against this. Try a new SDK following the instructions exactly.
 
Upvote 0

james_sgp

Active Member
Licensed User
Longtime User
I mean I used the B4ASdkManager, and nothing new is showing to install. Is that an issue?
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
I mean I used the B4ASdkManager, and nothing new is showing to install. Is that an issue?
Depends whether you have run it in the past and 'updated' anything. That example should run cleanly on a fresh install of both B4A and the recommended SDK.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…