When I added plugins to support the Kotlin in my project, Then after it read large string from my project's string.xml file. It gives me following error below.
error: string too large to encode using UTF-8 written instead as 'STRING_TOO_LARGE'.
When I added plugins to support the Kotlin in my project, Then after it read large string from my project's string.xml file. It gives me following error below.
error: string too large to encode using UTF-8 written instead as 'STRING_TOO_LARGE'.
It seems that a common cause for this is having a Stripe in your app/build.gradle, seems it has a vector file being read as a string longer than 32kB.
To solve this, change your stripe version to something after 7.0.0, which is where they fixed it. Current version of Stripe is 8.1.0.
This is an issue with the gradle plugin.
If you upgrade the plugin to 3.3.0-alpha06
or later and upgrade gradle to 4.9
it should work. It's not ideal since it is alpha, but it fixed the issue for me.
Add <?xml version="1.0" encoding="utf-8"?>
to the top of any resource .xml file that is missing it.
This is not really a Kotlin question, it's related to the build tools. This didn't happen on Build Tools 27 (Gradle 3.1) but happened for me after upgrading to Build Tools 28 (Gradle 3.2).
The solution is posted here STRING_TOO_LARGE Java compiler error.
When working with vector resources, you simply need to find and divide a string that is longer than 32kb, in my case, it was a complex path which I simplified a little to match the criterion of 32kb
Without seeing any of your code it's hard to do anything other than taking a guess at what might be potentially a possible problem.
Currently all that we can see is that there is in all likelihood a String that is too large to be encoded, else you would not get the error message.
How that String is built and why it exists...
that's a question that we can not really answer. You might want to elaborate your question a bit further so we can see a bit further down the rabbit hole and help finding a solution. :)
I had a very very long string in my strings.xml
file. By just deleting or shortening that strng the error disappeared.