Error: constant string too long

When run “gradlew build”, I encountered “error: constant string too long” for one of my java Class is my Unit Test Class and it contains testing data string which is very long. And there is no error when compile in Eclipse.
How can I solve this error for Gradle?

That’s not a Gradle specific error, but just a limitation of Java. You could simply put your test data in a file and read that in the test instead of putting a huge String into your test class.

Thanks very much. It’s a general Java compilation problem. I used another way to solve the problem: using StringBuilder instead of the String for the long constant string.