Android Studio 突然在 xml 文件中顯示自動生成的代碼。我試過使緩存無效/重啟,但它沒有解決問題。我也嘗試過清理項目并重建它,但它也不起作用。即使一切都在像 sublime text 這樣的編輯器中正確顯示。這是我的 android studio 顯示的 xml 文件之一的代碼。我認(rèn)為這是一個導(dǎo)入類問題。這個工作正常:import java.util.Map;import java.util.Properties;import edu.stanford.nlp.coref.CorefCoreAnnotations;import edu.stanford.nlp.coref.data.CorefChain;import edu.stanford.nlp.pipeline.Annotation;import edu.stanford.nlp.pipeline.StanfordCoreNLP;public class App { public static void main(String[] args) { Properties props = new Properties(); props.put("annotators", "tokenize,ssplit,pos,lemma,ner,parse,dcoref"); props.put("dcoref.score", true); StanfordCoreNLP corefPipeline = new StanfordCoreNLP(props); String text = "Barack Obama was born in Hawaii. He is the president. Obama was elected in 2008."; Annotation document = new Annotation(text); corefPipeline.annotate(document); // Chains is always null Map<Integer, CorefChain> chains = document.get(CorefCoreAnnotations.CorefChainAnnotation.class); System.out.println(chains); }}和輸出:{1=CHAIN1-["Barack Obama" in sentence 1, "He" in sentence 2, "the president" in sentence 2, "Obama" in sentence 3], 2=CHAIN2-["Hawaii" in sentence 1], 6=CHAIN6-["2008" in sentence 3]}這是我在 pom.xml 中的內(nèi)容:<dependencies> <dependency> <groupId>edu.stanford.nlp</groupId> <artifactId>stanford-corenlp</artifactId> <version>3.9.2</version> </dependency> <dependency> <groupId>edu.stanford.nlp</groupId> <artifactId>stanford-corenlp</artifactId> <version>3.9.2</version> <classifier>models</classifier> </dependency></dependencies>
3 回答

LEATH
TA貢獻(xiàn)1936條經(jīng)驗 獲得超7個贊
只需將現(xiàn)有項目復(fù)制到另一個文件夾并用android studio重新打開該項目,它就會再次正常顯示。
這個問題今天發(fā)生在我身上,當(dāng)我打開一個 java 文件時,android studio 向我展示了 XML 文件。

大話西游666
TA貢獻(xiàn)1817條經(jīng)驗 獲得超14個贊
如果您沒有清除android studio的緩存,請嘗試清除它。
C:\Users\user_Name\.AndroidStudio3.5\system\caches

慕容森
TA貢獻(xiàn)1853條經(jīng)驗 獲得超18個贊
這對我有用。首先關(guān)閉Android Studio。
然后去
C:\Users\your_user_name\.AndroidStudio3.5\system\caches
刪除緩存文件夾。
并打開安卓工作室。您的項目現(xiàn)在可以毫無問題地打開了。
添加回答
舉報
0/150
提交
取消