If anyone run into this issue while defining BuildConfig filed with type of string in your gradle file, then the trick for it to work is to add extra slash before \n
. Like this:
buildConfigField("String", "YourStringVariable", "\"First Line.\\nSecond Line.\"")