Android Question SOLVED - trouble since Update to v12.80

Herbert32

Active Member
Licensed User
Longtime User
Hello together,

since I updated to v12.80 from v12.20, I'm unable to run a project which uses parts of this Barcode-Reader Example


I receive following Error:

Error:
Error occurred on line: 787 (B4XMainPage)
java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.keywords.Common.CallSubDebug2(Common.java:1087)
    at b4a.Sachwerte.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:1071)
    at b4a.Sachwerte.b4xpagesmanager._showpage(b4xpagesmanager.java:503)
    at b4a.Sachwerte.b4xpagesmanager._addpage(b4xpagesmanager.java:323)
    at b4a.Sachwerte.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:337)
    at b4a.Sachwerte.b4xpagesmanager._initialize(b4xpagesmanager.java:168)
    at b4a.Sachwerte.main._activity_create(main.java:512)
    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:157)
    at b4a.Sachwerte.main.afterFirstLayout(main.java:105)
    at b4a.Sachwerte.main.access$000(main.java:17)
    at b4a.Sachwerte.main$WaitForLayout.run(main.java:83)
    at android.os.Handler.handleCallback(Handler.java:942)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:240)
    at android.os.Looper.loop(Looper.java:351)
    at android.app.ActivityThread.main(ActivityThread.java:8423)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:336)

in this Line:

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

Maybe someone has an Idea what happened here....

I have one Machine back, on which I use 12.20 - there everything works as expected

Also the example-project works without trouble on the 12.80 - System - but not my own project from 12.20

hopefully I have been able to explain what drives me crazy actually.

best regards
Herbert
 
Solution
I just checked your Manifest Again. Its missing the Google Play Macro


B4X:
AddApplicationText(<meta-data
    android:name="com.google.android.gms.vision.DEPENDENCIES"
    android:value="barcode,,face" />
)
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase) '<-----This is missing from'

Herbert32

Active Member
Licensed User
Longtime User
B4X:
Logger verbunden mit:  OnePlus IN2023
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
2376
true
2376
breite: 1016  höhe: 1658
*** Receiver (httputils2service) Receive (first time) ***
GetAllArtikel
b4xmainpage_createdetector (java line: 2110)
java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:132)
    at b4a.Sachwerte.b4xmainpage._createdetector(b4xmainpage.java:2110)
    at b4a.Sachwerte.b4xmainpage._b4xpage_created(b4xmainpage.java:459)
    at b4a.Sachwerte.b4xmainpage.callSub(b4xmainpage.java:5346)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1098)
    at anywheresoftware.b4a.keywords.Common.CallSubNew2(Common.java:1069)
    at b4a.Sachwerte.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:531)
    at b4a.Sachwerte.b4xpagesmanager._showpage(b4xpagesmanager.java:868)
    at b4a.Sachwerte.b4xpagesmanager._addpage(b4xpagesmanager.java:202)
    at b4a.Sachwerte.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:209)
    at b4a.Sachwerte.b4xpagesmanager._initialize(b4xpagesmanager.java:719)
    at b4a.Sachwerte.main._activity_create(main.java:445)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:221)
    at b4a.Sachwerte.main.afterFirstLayout(main.java:105)
    at b4a.Sachwerte.main.access$000(main.java:17)
    at b4a.Sachwerte.main$WaitForLayout.run(main.java:83)
    at android.os.Handler.handleCallback(Handler.java:942)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:240)
    at android.os.Looper.loop(Looper.java:351)
    at android.app.ActivityThread.main(ActivityThread.java:8423)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)
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)
    ... 26 more
b4xmainpage_createdetector (java line: 2110)
java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:132)
    at b4a.Sachwerte.b4xmainpage._createdetector(b4xmainpage.java:2110)
    at b4a.Sachwerte.b4xmainpage._b4xpage_created(b4xmainpage.java:459)
    at b4a.Sachwerte.b4xmainpage.callSub(b4xmainpage.java:5346)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1098)
    at anywheresoftware.b4a.keywords.Common.CallSubNew2(Common.java:1069)
    at b4a.Sachwerte.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:531)
    at b4a.Sachwerte.b4xpagesmanager._showpage(b4xpagesmanager.java:868)
    at b4a.Sachwerte.b4xpagesmanager._addpage(b4xpagesmanager.java:202)
    at b4a.Sachwerte.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:209)
    at b4a.Sachwerte.b4xpagesmanager._initialize(b4xpagesmanager.java:719)
    at b4a.Sachwerte.main._activity_create(main.java:445)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:221)
    at b4a.Sachwerte.main.afterFirstLayout(main.java:105)
    at b4a.Sachwerte.main.access$000(main.java:17)
    at b4a.Sachwerte.main$WaitForLayout.run(main.java:83)
    at android.os.Handler.handleCallback(Handler.java:942)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:240)
    at android.os.Looper.loop(Looper.java:351)
    at android.app.ActivityThread.main(ActivityThread.java:8423)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)
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)
    ... 26 more
 
Upvote 0

Herbert32

Active Member
Licensed User
Longtime User
this is the manifest-content

B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="33"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:usesCleartextTraffic, "true")   
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.DarkTheme)
'End of default text.
AddApplicationText(<meta-data
    android:name="com.google.android.gms.vision.DEPENDENCIES"
    android:value="barcode,,face" />
)
AddManifestText(<uses-permission
    android:name="android.permission.WRITE_EXTERNAL_STORAGE"
    android:maxSdkVersion="18" />
)

AddApplicationText(
  <provider
  android:name="android.support.v4.content.FileProvider"
  android:authorities="$PACKAGE$.provider"
  android:exported="false"
  android:grantUriPermissions="true">
  <meta-data
  android:name="android.support.FILE_PROVIDER_PATHS"
  android:resource="@xml/provider_paths"/>
  </provider>
)
CreateResource(xml, provider_paths,
   <files-path name="name" path="shared" />
)
 
Upvote 0

BlueVision

Active Member
Licensed User
Longtime User
Without investigating your code. Please have a look into the log in your post #3, line 40.
Does this hint of the logger put some light into your problem?
 
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
I have just run the Example from the library you sited in post #1 and it works Okay using B4A 12.80

Have you also added the Additional Jar reference in the Main Module?
B4X:
#AdditionalJar: com.google.android.gms:play-services-vision

If Possible, upload a small project
 
Upvote 0

Herbert32

Active Member
Licensed User
Longtime User
I have just run the Example from the library you sited in post #1 and it works Okay using B4A 12.80

Have you also added the Additional Jar reference in the Main Module?
B4X:
#AdditionalJar: com.google.android.gms:play-services-vision

If Possible, upload a small project
Yes, the example runs also here in 12.80

and yes, '#AdditionalJar: com.google.android.gms:play-services-vision' is also included in my Main Module
 
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
I just checked your Manifest Again. Its missing the Google Play Macro


B4X:
AddApplicationText(<meta-data
    android:name="com.google.android.gms.vision.DEPENDENCIES"
    android:value="barcode,,face" />
)
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase) '<-----This is missing from'
 
Upvote 1
Solution

Herbert32

Active Member
Licensed User
Longtime User
I'm also unsure, whether the problem is caused by the google-vision component - but I have nothing more than the error-message from the B4A-IDE, which is caused in this Line

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

I have a machine running version 12.2 where everything works as expected but as I'm in need to work outside my office, i had to install 12.80 on my notebook and here I'm unable to work because of this error...

If theree a way to download 12.2 somewhere so that i can continue my work?
 
Upvote 0

Herbert32

Active Member
Licensed User
Longtime User
I just checked your Manifest Again. Its missing the Google Play Macro


B4X:
AddApplicationText(<meta-data
    android:name="com.google.android.gms.vision.DEPENDENCIES"
    android:value="barcode,,face" />
)
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase) '<-----This is missing from'

GREAT <3 - thank you - this was the reason

I don't know why it worked in 12.20 but I'm really happy that it works now again
 
Upvote 0
Top