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'.
Kotlin strings are mostly similar to Java strings but has some new added functionalities. Kotlin strings are also immutable in nature means we can not change elements and length of the String. To declare a string in Kotlin, we need to use double quotes(” “), single quotes are not allowed to define Strings.
Using first() function The standard approach to converting a string to a char in Kotlin is to use the first() function, which returns the first index's element.
To find the length of string in Kotlin language, you can use String. length property. String. length property returns the number of characters in the string.
Kotlin has two types of string literals: Escaped String. Raw String.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With