在 Android Studio 3 的 Beta 版本中,即使 header 中声明了 UTF-16,androidManifest 文件似乎也被强制编码为 UTF-8。 这是一个错误还是现在有其他方法可以将 list 的编码更改回 UTF-8?
最佳答案
Android Studio 3(beta 和 RC-1)中使用 gradle 的应用构建过程使用的是 aapt2。
我比较了 Android Studio 2.x(gradle 版本 2.3.x)和 Adnroid Studio 3 Beta 和 RC-1(gradle 版本 4.1)生成的 AndroidManifest.xml。比较的结果是,在 Android Studio 2.x 中, list 编码为 UTF-16LE
,在 Android Studio 3 和新工具中, list 编码为 UTF-8
。 ..这恰好与您在上面的问题中提到的相反。
在 gradle.properties
文件中使用 android.enableAapt2=false
会导致构建系统使用旧的 aapt。
更多信息:https://developer.android.com/studio/build/gradle-plugin-3-0-0.html
更新:
昨天(10 月 23 日)有这条推文 ( https://twitter.com/the_very/status/922564040961826816 ):
add
systemProp.file.encoding=UTF-8
togradle.properties
to fix all encoding problems in both local and server builds
它确实对我有用。希望对你也有帮助。
关于android - 在 Android Studio 3 中将 androidManifest.xml 的编码更改为 UTF-8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46789253/