简体   繁体   中英

Android Studio java file gets corrupted

Unfortunaetly my laptop shutdown unproperly during coding in Android Studio. When I turned on again and tried to reload the project one class / java file was corrupted and suddenly all code was gone!

What I already tried:

  • Local History -> Show History = nothing to show
  • File / Invalidate Caches and Restart = no luck
  • Decompiled apk, but code has been obfuscated by Proguard, so it is almost impossible to read

Weird thing is that the java file has a size but the content is empty (I already deleted "nul nul nul" characters but still no luck.

Any help or advice?

I once had this issue and the way i solved it was to delete the folder C:\\Users\\cc.AndroidStudio3.2\\system\\caches.

i hope this helps

In my case there were 2 file 1 had XML code and other had java code. Delete the file that has XML code and rename your Java file the way it was. Solved my problem.

To solve the problem I would cut all the files from the project, allowing android studio to update its indices showing no files in the project tree. Soon after I move them all back then let android studio to load the files again. After loading the cache would get updated with the correct information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM