You can try to reduce the length of the static string by using a lateral string which combine several other strings like
B4X:
Dim FirstPart as string = $"First part of your HTML code"$
Dim SecondPart as string = $"Second part of your HTMLcode"$
Dim YourHTL as string = $"${FirstPart}${SecondPart}"$
That's not a string literal, it's a declaration of a public method returning a String and the error is a code error that seems to occur at End Sub so I suspect that the method is too large and needs refactoring into several Subs.