Android Studio 1.2 – Project encoding mismatches by default

Click File -> Settings (or click Ctrl + Alt + S) and find File Encodings in your Android Studio. See the image below as a reference.

Now you have three options

  • Change project encoding to match UTF-8 since both Gradle and
    Android Lint use this (recommended),
  • or change IDE encoding to match other encoding,
  • or just simply ignore the warning. If it worked out for you so far, it will continue to work anyway

enter image description here
(source: shrani.si)

Once you see the warning, you can directly click on “Open File Encoding Settings” as shown in the image below. This will take you to the same place as described above.

enter image description here

You can also see the current encoding of your file at the bottom right corner of Android studio. You can also change it there. See the image below.

IDE Encoding

Also you can specify charset in your build.gradle script like this

android {
    ...
    compileOptions {
        encoding "UTF-8"
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

According to Ashl7’s comment, you need to do a gradle sync for this to work

Leave a Comment