Android Studio compile gradle hint encoding error

Source: Internet
Author: User

In Android Studio, suppose our code has Chinese gaze. Display time completely normal, and compile when Gradle will error, but can compile successfully, and Gradle report error information, is garbled!

So we can not find the wrong reason, (quite deceptive ....) )

Said so much. Here's how to fix it:

In fact, the garbled error message is " encoded UTF-8 non-mapped characters ". So we can solve it in the following ways, for example

Set up the character set in the settings first:

Settings->file Encodings->ide Encodeing->utf-8

Settings->file Encodings->project Encodeing->utf-8

Assuming this is not possible, continue to look down, assuming that the following steps can be ignored

The following configuration is added to the Build.gradle under the corresponding module:

Tasks.withtype (Compile) {

options.encoding = "UTF-8"

}

But this configuration in gradle2.0 once was able to take effect, after gradle2.0 will not be effective, because Compile has been renamed to JavaCompile So the configuration that needs to be joined after gradle2.0 such as the following:

Tasks.withtype (javacompile) {

options.encoding = "UTF-8"

}

Android Studio compile gradle hint encoding error

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.