Skip to content Skip to sidebar Skip to footer

Why My Java Files Is Opening In Encoded Format On Android Studio

Till yesterday all files are ok, but today when I tried to open java files in android studio, its showing encoded format like: Since I have backup, I reverted that, but unable to

Solution 1:

Your Build folder is corrupt you need to rebuild the project.

First things first

File->Invalidate caches/Restart

enter image description here

If this doesn't work try rebuilding your project

enter image description here

Build->Clean Project then Build->rebuild project

If still no luck? Close Android Studio Try these:

1: Clear Android Studio Cache Delete this folder C:\Users%username%.AndroidStudio4.0\system\caches Check if the problem is solved

2: Rebuild manually Delete this folder and try again C:\Users%username%\AndroidStudioProjects<project name>\app\build

Solution 2:

The encoding used to compile your project is specified in the build.gradle files. The default, which is used when no specific encoding is specified, is UTF-8. We strongly recommend you use UTF-8 encoding whenever possible. The Android development tools create UTF-8 encoded projects by default, the Android Gradle plugin uses UTF-8 by default, and Android Lint will warn whenever it encounters XML files that are not using UTF-8

Add this in your build.gradle section.

android {
 compileOptions.encoding = 'UTF-8'

 ...
 }

OR

enter image description here

Then Clean-Rebuild-Restart

Post a Comment for "Why My Java Files Is Opening In Encoded Format On Android Studio"