1

I have a problem with Android Studio that happened all of a sudden today when I opened AS. As you may see in the pictures, some files are strange. In this picture you may see that some of the .java files have different icon

enter image description here

And totally wrong content enter image description here Same thing happens with SOME of the XML files which have different content enter image description here Also some of the PNG images are not displayed in AS. All files are ok, if for example I open them externally (notepad...) they are ok (luckily). Is there a way to fix it? I've already tried to invalidate cache/restart but it didnt work. Thanks

3
  • I'd try deleting your project from Android Studio (close the project until the project chooser dialog shows up, then click the X next to your project) and then re-import it from build.gradle
    – Ben P.
    Nov 7, 2018 at 22:47
  • @Ben P. I've tried it, I've also tried deleting .idea folder but it didnt work.
    – CalCon
    Nov 7, 2018 at 23:05
  • Due to no time to find a fine solution, I've reinstalled Android Studio and it worked. If someone has a more smart fix please post it for the others. Also just for your information, I guess the problem was probably about indexing, Android Studio took one file for another, for example when I opened one image from the drawable, he showed me a different one from the drawable folder, but that's a "fortunate" case, cause he took files from whatever folder. Hope it doesn't happen anymore and it doesn't happen to you guys. Bye.
    – CalCon
    Nov 8, 2018 at 12:15

3 Answers 3

6

So, it happened once again, but I've found a quick fix. I post it as an answer so people can easily spot it.

Quick fix:

  • Go to the folder "C:\Users\"your user"

  • Rename the folder ".AndroidStudio3.2" in ".AndroidStudio3.2backup"(name is example)

  • Launch Android Studio, It will not find configuration files, so it will ask you if you want to import them from the folder ".AndroidStudio3.2backup"

  • Click yes, few seconds and now you can delete the backup folder cause it will be created another ".AndroidStudio3.2" folder. Notice that I've renamed the original folder instead of delete it for security, and so to avoid to reconfigure Andoid Studio again, but you can choose to start a new configuration if you want.

  • Once launched Android Studio, click import (gradle...) and import your project.

Everything worked fine after this few seconds quick fix. Hope it helps.

1

In fact this problem has been reported to the Android Studio team already.

A workaround would be to delete the caches folder of the Android Studio directory:

C:\Users\USERNAME\.AndroidStudio3.3\system\caches

This at least is the recommendation from the issue tracker and worked for me as well.

0

The same happened to me when I updated the libraries in gradle kotlin, etc. what I did was to download my project from my version manager and update the libraries one by one and prove the project works.

3
  • Dunno, I've reinstalled Android Studio and reconfigured it. It took me a good amount of time, but in the end it worked. Hope someone read this topic and write a less time-wasting solution. Thanks.
    – CalCon
    Nov 8, 2018 at 12:18
  • same thing happened to me. did reinstalling AS finally corrected those errors?
    – Jeongbebs
    Nov 11, 2018 at 14:35
  • @Jeongbebs I've posted a quick fix. Hope it helps.
    – CalCon
    Nov 12, 2018 at 12:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.