Callsub(main issue

Rusty

Well-Known Member
Licensed User
Longtime User
I have an app that runs fine in debug mode and in release mode, but when I put it in release obfuscated (preferred deployment), a callsub from a service fails with a Java error indicating the sub is not found.
This is the code within the service. The callsub(main, "ViewHighLight") highlights the current view while the .mp3 file is playing. The ViewHighlight sub in the main does this work because it has access to the views.
In debug and release it all works fine. Release Obfuscated it complains with:
An error has occurred in sub:ttsservice_mediaplayer1_complete ... Java.lang.exception: sub viewhighlight was not found. Continue?
B4X:
'When the media is finished see if there is more to play
Sub MediaPlayer1_Complete
   If Main.MediaQueue(0).vox <> "" Then
      CallSub(Main, "ViewHighLight")                     'highlight the next vox
      Main.MediaPlayer1.Load(Main.MediaQueue(0).VoxFldr, Main.MediaQueue(0).Vox)
      Main.MediaPlayer1.Play
      CallSub(Main, "ViewHighLight")                     'remove any highlight that was there
      RemoveFromMediaQueue(0)      'remove it from the queue
   End If
End Sub
This code worked fine with release 1.90. I'm now on release 2.00
Any ideas?
Thanks
 

margret

Well-Known Member
Licensed User
Longtime User
You can look in your Objects folder for a file called: ObfuscatorMap.txt. It may have some information that will help.

I think the main problem is the variable or string in the CallSub() is being renamed and the sub name is not. So, it is indeed missing after the compile.

Try changing the name of the sub to:

View_HighLight

and make sure you change all other references to that Object the same and it should work. The underscore added to the name will keep your CallSub Variable / String from being renamed.
 
Last edited:
Upvote 0
Top