Change encoding of androidManifest.xml to UTF-8 in Android Studio 3

前端 未结 1 873
名媛妹妹
名媛妹妹 2021-01-07 07:01

In the beta version of Android Studio 3 it seems that the androidManifest file is encoded forcefully into UTF-8 even if UTF-16 is stated in the header. Is this a bug or is t

相关标签:
1条回答
  • 2021-01-07 07:48

    The app build process using gradle in Android Studio 3 (beta and RC-1) is using aapt2.

    I compared the AndroidManifest.xml generated by the Android Studio 2.x (gradle version 2.3.x) and Adnroid Studio 3 Beta and RC-1 (gradle version 4.1). The result of the comparison is that with Android Studio 2.x the manifest encoding is UTF-16LE and with Android Studio 3 and the new tools, it is UTF-8... which happens to be the opposite of what you mentioned in the question above.

    Using android.enableAapt2=false in the gradle.properties file, results in the build system using the old aapt.

    More info: https://developer.android.com/studio/build/gradle-plugin-3-0-0.html

    UPDATE:

    There is this tweet from yesterday (Oct 23rd) (https://twitter.com/the_very/status/922564040961826816):

    add systemProp.file.encoding=UTF-8 to gradle.properties to fix all encoding problems in both local and server builds

    It does work for me. I hope it helps you too.

    0 讨论(0)
提交回复
热议问题