I bit of background (not sure how relevant it is):
My app is using geofences, pretty much based on the example code by Erel. In that code there's this sub:
While developing I had the package name set to (something like)
Everything worked nicely. Then I changed the package name to the correct (sort of like)
And all of a sudden I'm getting crashes in line #5 above. Specifically, it's this part causing the crash:
And this is the unfiltered log:
I want to stress that this is reproducible. I change the package name to com.example.app15, clean project and install - works great. I change the package name to com.example.app, clean project and install - crash. Repeated a dozen times until I started believing my eyes.
I find this super confusing, what could be causing this? And how do I solve it?
(I did find two other threads mentioning crashes, 1 and 2, related to package names, but they didn't seem relevant to this post. One post mention problems using uppercase characters in the package name, so I want to say that I only use lowercase characters.)
My app is using geofences, pretty much based on the example code by Erel. In that code there's this sub:
B4X:
Private Sub CreateGeofenceRequest (GeofenceBuilder As JavaObject) As JavaObject
Dim builder As JavaObject
builder.InitializeNewInstance("com.google.android.gms.location.GeofencingRequest$Builder", Null)
builder.RunMethod("setInitialTrigger", Array(1)) 'INITIAL_TRIGGER_ENTER
builder.RunMethod("addGeofence", Array(GeofenceBuilder.RunMethod("build", Null)))
Return builder.RunMethod("build", Null)
End Sub
While developing I had the package name set to (something like)
B4X:
com.example.app15
Everything worked nicely. Then I changed the package name to the correct (sort of like)
B4X:
com.example.app
And all of a sudden I'm getting crashes in line #5 above. Specifically, it's this part causing the crash:
B4X:
GeofenceBuilder.RunMethod("build", Null)
And this is the unfiltered log:
B4X:
Error occurred on line: 109 (SRVC_GEOFENCE)
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 net.myapp.test.srvc_geofence._creategeofencerequest(srvc_geofence.java:292)
at net.myapp.test.srvc_geofence$ResumableSub_AddGeofence.resume(srvc_geofence.java:204)
at net.myapp.test.srvc_geofence._addgeofence(srvc_geofence.java:169)
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 anywheresoftware.b4a.BA$2.run(BA.java:387)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7664)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.IllegalArgumentException: invalid radius: 0.0
at com.google.android.gms.internal.location.zzbh.<init>(Unknown Source:176)
at com.google.android.gms.location.Geofence$Builder.build(Unknown Source:162)
... 26 more
null: 190
java.net.SocketException: Socket closed
at java.net.SocketInputStream.read(SocketInputStream.java:209)
at java.net.SocketInputStream.read(SocketInputStream.java:144)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:248)
at java.io.BufferedInputStream.read(BufferedInputStream.java:267)
at anywheresoftware.b4a.shell.ShellConnector.readControlData(ShellConnector.java:191)
at anywheresoftware.b4a.shell.ShellConnector.connect(ShellConnector.java:186)
at anywheresoftware.b4a.shell.ShellConnector.run(ShellConnector.java:119)
at java.lang.Thread.run(Thread.java:923)
I want to stress that this is reproducible. I change the package name to com.example.app15, clean project and install - works great. I change the package name to com.example.app, clean project and install - crash. Repeated a dozen times until I started believing my eyes.
I find this super confusing, what could be causing this? And how do I solve it?
(I did find two other threads mentioning crashes, 1 and 2, related to package names, but they didn't seem relevant to this post. One post mention problems using uppercase characters in the package name, so I want to say that I only use lowercase characters.)
Last edited: