I lost code after closing android studio project, any reason why?

Viewed 382

I lost all my code of every file after closing android studio. this happens twice time in my life. Can anybody tell me how to prevent this issue? Code removed from every file and display this line on every file.

See this image

<component name="libraryTable">
  <library name="Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:1.3.30@jar">
    <CLASSES>
      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.3.30/
      989a125fdb6e4d0d75a016032e03e1e3b57a13d/kotlin-stdlib-common-1.3.30.jar!/" />
    </CLASSES>
    <JAVADOC />
    <SOURCES>
      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.3.30/
      9c981bc2a33066176e605b58a84170b8116e9d8c/kotlin-stdlib-common-1.3.30-sources.jar!/" />
    </SOURCES>
  </library>
</component>   
2 Answers

Yes, it sort of happens few times. Not sure why. But the following approach can hopefully fix it.

  1. Close Android Studio
  2. Go to the following location (for Windows)

C:\Users(YOUR USERNAME).AndroidStudio(VERSION)\system\

  1. Delete folder caches
  2. Start Android Studio again

The problem arises sometimes if you open two projects together. The bug is already reported here.

The easiest solution is to delete following caches folder

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

Related