我遇到了一个非常奇怪的情况,当我重新启动我的电脑后,由于 Windows 冻结,我在 Android Studio 中的一些 java 代码被转换为一些奇怪的 xml 代码,而我编写的所有这些代码都丢失了!我遇到过两次这种情况,第一次遇到这种情况时,我将代码恢复到最后一次提交,因为在最后一次提交之后更改很少。然而这次在最后一次提交之后变化是巨大的,我完全困惑了!
下面是我的一个小代码是如何转换的。
<component name="libraryTable">
<library name="Gradle: com.android.support:print:28.0.0@aar">
<ANNOTATIONS>
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/print-28.0.0.aar/87cddf7f66cc3e6d635cf04e7292a008/annotations.zip!/" />
</ANNOTATIONS>
<CLASSES>
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/print-28.0.0.aar/87cddf7f66cc3e6d635cf04e7292a008/res" />
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/print-28.0.0.aar/87cddf7f66cc3e6d635cf04e7292a008/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
我的 Android Studio 版本:3.3.1
有没有办法找回我写的代码?
任何帮助,将不胜感激。
编辑
我再次面临同样的情况。这是我用 xml 替换的另一个代码之一
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AndroidConfiguredLogFilters">
<filters>
<filter>
<option name="logLevel" value="verbose" />
<option name="logMessagePattern" value="" />
<option name="logTagPattern" value="(MainActivity|Download|BooksFrag|Reading|BookPage|BookDetails|PageNumberPicker)" />
<option name="name" value="Unnamed-0" />
<option name="packageNamePattern" value="" />
<option name="pid" value="" />
</filter>
</filters>
</component>
<component name="AndroidLayouts">
<shared>
<config />
</shared>
</component>
<component name="AndroidLogFilters">
<option name="TOOL_WINDOW_CONFIGURED_FILTER" value="Unnamed-0" />
</component>
<component name="ChangeListManager">
<list default="true" id="0218df07-b316-45c7-a2ad-66ba2c0b4c43" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/app/src/main/java/com/sed/maktaba_daar_al_hadeeth/utilities/RealmDBHelper.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/com/sed/maktaba_daar_al_hadeeth/BookSearchResultsContainer.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/com/sed/maktaba_daar_al_hadeeth/BookSearchResultsContainer.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/com/sed/maktaba_daar_al_hadeeth/BookSearcher.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/com/sed/maktaba_daar_al_hadeeth/BookSearcher.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/com/sed/maktaba_daar_al_hadeeth/SearchOptions.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/com/sed/maktaba_daar_al_hadeeth/SearchOptions.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/com/sed/maktaba_daar_al_hadeeth/SearchResult.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/com/sed/maktaba_daar_al_hadeeth/SearchResult.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/com/sed/maktaba_daar_al_hadeeth/SearchResultViewHolder.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/com/sed/maktaba_daar_al_hadeeth/SearchResultViewHolder.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/com/sed/maktaba_daar_al_hadeeth/activities/ReadingActivity.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/com/sed/maktaba_daar_al_hadeeth/activities/ReadingActivity.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/com/sed/maktaba_daar_al_hadeeth/utilities/ArabicUtilities.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/com/sed/maktaba_daar_al_hadeeth/utilities/ArabicUtilities.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/values/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values/strings.xml" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ExternalProjectsManager">
<system id="GRADLE">
<state>
<projects_view />
</state>
</system>
</component>
<component name="FUSProjectUsageTrigger">
<session id="1042793738">
<usages-collector id="statistics.lifecycle.project">
<counts>
<entry key="project.closed" value="23" />
<entry key="project.open.time.12" value="2" />
<entry key="project.open.time.13" value="2" />
<entry key="project.open.time.14" value="1" />
<entry key="project.open.time.15" value="3" />
<entry key="project.open.time.16" value="1" />
<entry key="project.open.time.17" value="1" />
<entry key="project.open.time.18" value="2" />
<entry key="project.open.time.2" value="1" />
<entry key="project.open.time.21" value="1" />
<entry key="project.open.time.22" value="1" />
<entry key="project.open.time.24" value="1" />
<entry key="project.open.time.25" value="2" />
<entry key="project.open.time.26" value="2" />
<entry key="project.open.time.27" value="5" />
<entry key="project.open.time.28" value="1" />
<entry key="project.open.time.29" value="1" />
<entry key="project.open.time.3" value="1" />
<entry key="project.open.time.30" value="1" />
<entry key="project.open.time.31" value="1" />
<entry key="project.open.time.32" value="1" />
<entry key="project.open.time.36" value="1" />
<entry key="project.open.time.4" value="1" />
<entry key="project.open.time.46" value="1" />
<entry key="project.open.time.49" value="1" />
<entry key="project.open.time.5" value="2" />
<entry key="project.open.time.50" value="1" />
<entry key="project.open.time.51" value="1" />
<entry key="project.open.time.6" value="2" />
<entry key="project.open.time.7" value="1" />
<entry key="project.open.time.8" value="2" />
<entry key="project.opened" value="44" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.extensions.open">
<counts>
<entry key="MF" value="1" />
<entry key="css" value="4" />
<entry key="csv" value="11" />
<entry key="gradle" value="14" />
<entry key="java" value="298" />
<entry key="js" value="19" />
我在此处记录了 Google 的问题。
谢谢。
编辑(2019 年 11 月)
我也在 android studio 3.5.2 中遇到过这个问题。看来问题还没有解决。