Android Studio sets the project Module encoding to solve the problem of garbled characters during the running of the Android Studio project. moduleandroid

Source: Internet
Author: User

Android Studio sets the project Module encoding to solve the problem of garbled characters during the running of the Android Studio project. moduleandroid

The project Setting logic of Android Studio is very different from that of Eclipse. The operation is File-> Setting-> File Encodings, and then you can set it ,:

Open the module build. gradle file to modify the encoding used by the compiler. The above settings only affect the encoding of the file content you see in the editor view in the IDE. The encoding used by the compiler also needs to be set separately. Otherwise, gradle uses UTF-8 encoding by default and the actual encoding of the file is inconsistent, leading to garbled characters during program running.
Gradle configuration encoding is configured in the build. gradle script file. You can add up and down configurations.

Android {... compileOptions {encoding "GBK "}}

If you only set the Encoding of a File, open the File directly in Android Studio and right-click the File Encoding option.




Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.