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
(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.
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.
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
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…