Bug? Smart String Literal over multiple lines And Obfuscation

cimperia

Active Member
Licensed User
Longtime User
I have a project where I have the following query stored in a Smart String Literal. The query is actually much longer, but the issue will reveal itself with this cut-down version:

B4X:
Sub Process_Globals
   Private Const SELECT_ALL As String = _
   $"SELECT
             id
   ,         kt_mem_deck
   ,         kt_name
   FROM
            v_stacktestsettings"$
End Sub

I am not trying to obfuscate this variable at this stage, but when I compile the project with "Release (obfuscated)", at run time the app fails with the current error:

B4X:
android.database.sqlite.SQLiteException: unrecognized token: "\" (code 1): , while compiling: SELECT\n    id\n   ,  kt_mem_deck\n   ,  kt_name\n   FROM\n    v_stacktestsettings

It looks like the new lines characters '\n' get messed up ...

If I use this query where the text holds on one line, the apps runs OK:
B4X:
  Private Const SELECT_ALL As String = _
  $"SELECT id, kt_mem_deck, kt_name FROM v_stacktestsettings"$

If I remove the "_" from the variable name, the issue persists, as it looks that the issue is with the new line character in obfuscated mode.
 

cimperia

Active Member
Licensed User
Longtime User
OK thanks. I can't move "it" to Globals as the query is used in multiple activities, however I reverted to the regular string and it works fine.
 
Top