Kotlin中的STRING_TOO_LARGE字符串 [英] STRING_TOO_LARGE String in Kotlin

查看:530
本文介绍了Kotlin中的STRING_TOO_LARGE字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在项目中添加支持 Kotlin 的插件时,然后从项目的 string.xml 文件中读取大字符串.它在下面给了我以下错误.

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.

错误:字符串太大,无法使用UTF-8编码,而是写为" STRING_TOO_LARGE ".

error: string too large to encode using UTF-8 written instead as 'STRING_TOO_LARGE'.

推荐答案

这是gradle插件的问题.

如果将插件升级到3.3.0-alpha06或更高版本,并将gradle升级到4.9,则它应该可以工作.由于它是Alpha,因此并不理想,但它为我解决了这个问题.

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.

<?xml version="1.0" encoding="utf-8"?>添加到任何缺少该资源的.xml文件的顶部.

Add <?xml version="1.0" encoding="utf-8"?> to the top of any resource .xml file that is missing it.

这篇关于Kotlin中的STRING_TOO_LARGE字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆