About Android's gradle Chinese compiler Error Solution

Source: Internet
Author: User

Normally, this error occurs when Chinese appears in the Java Project code


or compile through, but when the run of Chinese garbled.


This time only need to add the following sentence in the Build.gradle can be solved

Tasks.withtype (javacompile) {
    options.encoding = ' UTF-8 '
}


For example, the following code

Package com.liran.main.Stream;

Import Java.io.FileOutputStream;
Import Java.nio.file.Files;
Import java.nio.file.Paths;
Import java.util.List;

/**
 * Test through the files and paths operation file
 * Created by Liran on 2015-10-19.
 *
/public class Newio2test {public

    static void Main (string[] args) throws Exception {

        System.out.println (" Ah ah ah ah ");
        Copy file
        files.copy (Paths.get ("Newio2test.java"), New FileOutputStream ("NewIO2Test.txt"));


        List<string> Lines=files.readalllines (Paths.get ("Newio2test.java"));
        SYSTEM.OUT.PRINTLN (lines);
    }



There's going to be the wrong one.



This time I add that phrase and compile

Apply plugin: ' java '

dependencies {
    compile filetree (dir: ' Libs ', include: [' *.jar ']
}

Tasks.withtype (javacompile) {
    options.encoding = ' UTF-8 '
}


Passed the


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.