0

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

enter image description here

Since I have backup, I reverted that, but unable to understand the root cause any help would be appreciable.

Sandeep Tiwari
  • 2,042
  • 3
  • 24
  • 47

2 Answers2

2

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

Pritam Pawade
  • 637
  • 7
  • 21
  • Clear Android Studio Cache Delete this folder C:\Users%username%.AndroidStudio4.0\system\caches Check if the problem is solved: This worked in my case: thanks – Sandeep Tiwari Jul 22 '20 at 05:13
0

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

IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198