xml文件中的文本不完整,导致新创建的Android Studio项目出现错误

亦余心之所善兮,虽九死其犹未悔。这篇文章主要讲述xml文件中的文本不完整,导致新创建的Android Studio项目出现错误相关的知识,希望能为你提供帮助。
只是一个小问题,但这是我第一次遇到这样的错误。我想知道是否有人在使用最新的android Studio版本(3.5.3)时遇到相同的情况?
这是通过创建一个空白活动的新android项目。 (选中或未选中的即时应用程序具有相同的效果)。
已经尝试在创建新项目之前使缓存无效并重新启动。但是,我仍然得到相同的不完整文本和错误。我最后的选择是重新安装AS。
Colors.xml:

xml文件中的文本不完整,导致新创建的Android Studio项目出现错误

文章图片

其他xml文件::
【xml文件中的文本不完整,导致新创建的Android Studio项目出现错误】
xml文件中的文本不完整,导致新创建的Android Studio项目出现错误

文章图片

xml文件中的文本不完整,导致新创建的Android Studio项目出现错误

文章图片

我遇到的IDE错误(我发送给Google的错误报告:]
java.lang.NullPointerException at com.intellij.xml.arrangement.XmlArrangementVisitor.createNewEntry(XmlArrangementVisitor.java:94) at com.intellij.xml.arrangement.XmlArrangementVisitor.visitXmlTag(XmlArrangementVisitor.java:52) at com.intellij.psi.impl.source.xml.XmlTagImpl.accept(XmlTagImpl.java:1027) at com.intellij.xml.arrangement.XmlArrangementVisitor.visitXmlFile(XmlArrangementVisitor.java:45) at com.intellij.psi.impl.source.xml.XmlFileImpl.accept(XmlFileImpl.java:71) at com.intellij.xml.arrangement.XmlRearranger.parse(XmlRearranger.java:128) at com.intellij.psi.codeStyle.arrangement.engine.ArrangementEngine$Context.from(ArrangementEngine.java:540) at com.intellij.psi.codeStyle.arrangement.engine.ArrangementEngine.arrange(ArrangementEngine.java:132) at com.intellij.psi.codeStyle.arrangement.engine.ArrangementEngine.arrange(ArrangementEngine.java:93) at com.android.tools.idea.templates.TemplateUtils.reformatAndRearrange(TemplateUtils.java:346) at com.android.tools.idea.templates.TemplateUtils.reformatAndRearrange(TemplateUtils.java:303) at com.android.tools.idea.templates.TemplateUtils$1.run(TemplateUtils.java:282) at com.intellij.openapi.command.WriteCommandAction.lambda$runWriteCommandAction$5(WriteCommandAction.java:361) at com.intellij.openapi.command.WriteCommandAction$BuilderImpl$1.run(WriteCommandAction.java:124) at com.intellij.openapi.application.RunResult.run(RunResult.java:35) at com.intellij.openapi.command.WriteCommandAction.lambda$null$1(WriteCommandAction.java:263) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1055) at com.intellij.openapi.command.WriteCommandAction.lambda$performWriteCommandAction$2(WriteCommandAction.java:262) at com.intellij.openapi.command.WriteCommandAction.lambda$doExecuteCommand$4(WriteCommandAction.java:319) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:220) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:188) at com.intellij.openapi.command.WriteCommandAction.doExecuteCommand(WriteCommandAction.java:321) at com.intellij.openapi.command.WriteCommandAction.performWriteCommandAction(WriteCommandAction.java:262) at com.intellij.openapi.command.WriteCommandAction.execute(WriteCommandAction.java:244) at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.run(WriteCommandAction.java:126) at com.intellij.openapi.command.WriteCommandAction.runWriteCommandAction(WriteCommandAction.java:361) at com.intellij.openapi.command.WriteCommandAction.runWriteCommandAction(WriteCommandAction.java:353) at com.android.tools.idea.templates.TemplateUtils.reformatAndRearrange(TemplateUtils.java:272) at com.android.tools.idea.templates.Template.lambda$render$1(Template.java:279) at com.intellij.ide.startup.impl.StartupManagerImpl.runActivity(StartupManagerImpl.java:360) at com.intellij.ide.startup.impl.StartupManagerImpl.lambda$queueSmartModeActivity$3(StartupManagerImpl.java:166) at com.intellij.openapi.project.DumbServiceImpl.lambda$runWhenSmart$0(DumbServiceImpl.java:232) at com.intellij.ide.startup.impl.StartupManagerImpl.lambda$runWhenProjectIsInitialized$6(StartupManagerImpl.java:392) at com.intellij.ui.GuiUtils.invokeLaterIfNeeded(GuiUtils.java:377) at com.intellij.ide.startup.impl.StartupManagerImpl.runWhenProjectIsInitialized(StartupManagerImpl.java:394) at com.intellij.openapi.project.DumbServiceImpl.runWhenSmart(DumbServiceImpl.java:224) at com.intellij.ide.startup.impl.StartupManagerImpl.queueSmartModeActivity(StartupManagerImpl.java:166) at com.intellij.ide.startup.impl.StartupManagerImpl.access$400(StartupManagerImpl.java:48) at com.intellij.ide.startup.impl.StartupManagerImpl$1.lambda$run$0(StartupManagerImpl.java:196) at java.util.ArrayList.forEach(ArrayList.java:1257) at com.intellij.ide.startup.impl.StartupManagerImpl$1.run(StartupManagerImpl.java:196) at com.intellij.openapi.project.DumbServiceImpl.doRun(DumbServiceImpl.java:380) at com.intellij.openapi.project.DumbServiceImpl.updateFinished(DumbServiceImpl.java:372) at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88) at com.intellij.openapi.application.TransactionGuardImpl.lambda$pollQueueLater$0(TransactionGuardImpl.java:74) at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:435) at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:419) at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:403) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764) at java.awt.EventQueue.access$500(EventQueue.java:98) at java.awt.EventQueue$3.run(EventQueue.java:715) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) at java.awt.EventQueue.dispatchEvent(EventQueue.java:734) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:757) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:706) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:375) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

答案我尚未发现错误的原因,但我怀疑配置文件夹中的某些文件已损坏。
我设法通过重命名/删除C:Users\%USERPROFILE%.AndroidStudio3.5文件夹来修复它。
默认情况下该文件夹是隐藏的,因此请确保首先更改文件夹选项/显示隐藏的文件夹中的设置。
重新打开Android Studio,跳过导入配置,它将再次运行。

    推荐阅读