Android Question B4A 8.3 Beta - App Crashing

GuyBooth

Active Member
Licensed User
Longtime User
Can't give any details at this stage, I've gone back to v 3.80. My app was crashing with the following logs:
B4X:
Sub SetPlayerStrings
ActiveSubName is not (yet) Valid
Error occurred on line: 80 (clMultiPlayer)
java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.keywords.Common.CallSubDebug3(Common.java:1036)
    at b4a.themusicmachine.tmm_flipflop._setplayerstrings(tmm_flipflop.java:2006)
    at b4a.themusicmachine.tmm_flipflop._service_start(tmm_flipflop.java:2081)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:735)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:360)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:260)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
    at b4a.themusicmachine.tmm_flipflop.handleStart(tmm_flipflop.java:100)
    at b4a.themusicmachine.tmm_flipflop.access$000(tmm_flipflop.java:8)
    at b4a.themusicmachine.tmm_flipflop$1.run(tmm_flipflop.java:71)
    at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.onStartCommand(ServiceHelper.java:221)
    at b4a.themusicmachine.tmm_flipflop.onStartCommand(tmm_flipflop.java:69)
    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3738)
    at android.app.ActivityThread.-wrap23(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1744)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6780)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:333)
    at anywheresoftware.b4a.debug.Debug.CallSubNew3(Debug.java:285)
    ... 25 more
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:315)
    ... 26 more
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.keywords.Common.CallSubDebug(Common.java:1026)
    at b4a.themusicmachine.clmultiplayer._execute(clmultiplayer.java:88)
    at b4a.themusicmachine.tmm_flipflop._flip_streamsub(tmm_flipflop.java:976)
    ... 28 more
Caused by: java.lang.RuntimeException: java.lang.Exception: Sub getTrack_Overlap signature does not match expected signature.
    at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:333)
    at anywheresoftware.b4a.debug.Debug.CallSubNew(Debug.java:279)
    ... 32 more
Caused by: java.lang.Exception: Sub getTrack_Overlap signature does not match expected signature.
    at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:318)
    ... 33 more
The clMultiplayer is a class. Line 80 code is:
B4X:
Sub Execute(SubName As String) As Object
    Return CallSub("", SubName)
End Sub
Not much to go on I know but perhaps it helps.
The same code works in v 3.80. .. no, I mean 8.0
 
Last edited:

GuyBooth

Active Member
Licensed User
Longtime User
Are you actually using v3.80? It is very old now.

My mistake, getting my 8's and 3's mixed. I was using 8.0

This looks like a debugger issue. It would have probably been solved by cleaning the project (Ctrl + P).

It does run fine in both Release modes, but not in debug mode. Tried cleaning it with both versions, no improvement.
 
Upvote 0

GuyBooth

Active Member
Licensed User
Longtime User
This is the relevant error:
Sub getTrack_Overlap signature does not match expected signature.

If you like send me the project and I'll check it.

If I remove the getTrack_Overlap call, the problem just moves to the next of several lines that call with a similar structure.
Just to understand something here:
This code has been in place and working for a long time (years) so it is not unproven.
The code works fine and does what is expected in Release modes.
This is a project with many moving parts, and sending the whole thing to you will probably not help.

I'll see if I can set up a project with similar calls (they're indirect calls to a sub in a named class) to reproduce it.
 
Upvote 0

GuyBooth

Active Member
Licensed User
Longtime User
I created a small project that includes the relevant calls. It works ok.
I tried emptying the data cache, it made no difference.
Now I have uninstalled the app and am reinstalling it to see what happens, but I've run into a problem with the install - posted on a separate thread.
Will be back here when that has been resolved.
 
Upvote 0

GuyBooth

Active Member
Licensed User
Longtime User
I created a small project that includes the relevant calls. It works ok.
I tried emptying the data cache, it made no difference.
Complete reinstallation of the app made no difference. If I step through in Debug mode the problem doesn't show up.
The attached small project shows the code, but on this small project it works fine. Makes me wonder if there's a timing issue or a stack/memory issue when I'm running the proper app to cause the problem.
 

Attachments

  • Indirect_Call_Bug_Test.zip
    14.7 KB · Views: 164
Upvote 0

GuyBooth

Active Member
Licensed User
Longtime User
If you like you can send me the complete project with the libraries and I'll test it here. Without the project that reproduces the issue it will be difficult to fix it.
Ok - I've prepared everything to send you. Just have to figure out how do I do that? Do I start a conversation from my inbox?
(Update: Found an address to send to you - files are on their way).
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Thank you. I've found the source of this issue.

It is a mistake to set the Component parameter to an empty string (""). You should replace it with Me instead:
B4X:
Sub Execute(SubName As String) As Object
   Return CallSub(Me, SubName)
End Sub

While it seemed to work properly in older versions it actually didn't. It treated the class instance as if it is a singleton module.
 
Upvote 0

GuyBooth

Active Member
Licensed User
Longtime User
That fixed it Erel, thanks.
Interestingly, I think when I wrote that code (years ago), Me didn't work, it had to be "" - which went against the normal syntax.
Of course, my memory may be fooling me again.
 
Upvote 0
Top