3

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>   
P A Gosai
  • 553
  • 5
  • 22
  • Go to project location in File Explorer and open you code files in simple text editor like Notepad, Notepad++ sort of and see if it is there or not. – gprathour Jun 12 '19 at 10:54
  • @gprathour I open from explorer and its nothing changed(looks good) issue on android studio. how can i resolve this – P A Gosai Jun 12 '19 at 10:59
  • 1
    Possible duplicate of [Android Studio shows wrong file contents](https://stackoverflow.com/questions/53249677/android-studio-shows-wrong-file-contents) – Markus Kauppinen Jun 12 '19 at 11:23
  • Its always better practice to save your work often. Do ctrl+s after any change. – Akshatha S R Jun 12 '19 at 12:10

2 Answers2

2

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
gprathour
  • 14,813
  • 5
  • 66
  • 90
1

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

gprathour
  • 14,813
  • 5
  • 66
  • 90
Deˣ
  • 4,191
  • 15
  • 24