Bug? #if JavaWhatever throws compiler error 'unclosed character literal'

Similar threads

B4A Tutorial [B4X] Smart String Literal
Java Question Persian characters in Java project
B4A Code Snippet [B4X] Use WebView to show large images
B4A Code Snippet Advertising id
B4A Tutorial Inline Java Code


Active Member
Licensed User
Hi Erel,

You already know you've got brilliant products, but still: brilliant products ! :) I came across this issue - it took me a while to figure out what was going on and I reckon it's a bug. I use B4A 4.30 with Build Configurations. In a shared code module I had

#If JavaObject
#End If
As of B4A 4.30 with the inline Java, the '#If Java' (regardless of any other characters following in that string) seems to be interpreted by the compiler as the start of inline Java and the error 'unclosed character literal' comes up. Changing 'Java' to 'Ja_va' obviously solved it, so no big deal, but it was confusing and I presume this behaviour wasn't intentional.