gpt4 book ai didi

Android 文件(Java 和 XML)被奇怪的 XML 取代

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:41:44 25 4
gpt4 key购买 nike

<分区>

我在使用 Android Studio(v2.3.3,构建于 2017-06-06)时遇到了一个奇怪的问题。我的一个 Java 文件被替换为似乎由 Android Studio 生成的不相关的 XML。我不认为我做了什么来触发它。不久之后,第二个 Java 文件再次遭受同样的命运,没有明显的原因。

谢天谢地,我刚刚压缩了一份源代码副本,所以我删除了文件并替换了它们。我没有奇怪代码的精确副本,但我在 git.moeryn.com 找到了这段代码与我看到的非常接近:

<application>
<component name="UsageTrigger">
<counts>
<entry feature="CreateFile.CreateFileAction" count="1" />
<entry feature="JSDebugConfig.Debug.browser-default.preferredBrowser-null.no_mappings" count="6" />
<entry feature="OpenInBrowser.Opera" count="1" />
<entry feature="execute.Application.Coverage" count="1" />
<entry feature="execute.Application.Debug" count="1" />
<entry feature="execute.Application.Run" count="15" />
<entry feature="execute.GWT.ConfigurationType.Debug" count="12" />
<entry feature="execute.GWT.ConfigurationType.Run" count="18" />
<entry feature="execute.GroovyScriptRunConfiguration.Debug" count="1" />
<entry feature="execute.GroovyScriptRunConfiguration.Run" count="9" />
<entry feature="execute.JUnit.Coverage" count="4" />
<entry feature="execute.JUnit.Run" count="86" />
<entry feature="execute.JavascriptDebugType.Debug" count="6" />
<entry feature="ide.settings.Appearance" count="4" />
<entry feature="ide.settings.Colors_&amp;_Fonts" count="1" />
<entry feature="ide.settings.Console_Font" count="4" />
<entry feature="ide.settings.Font" count="4" />
<entry feature="ide.settings.General" count="1" />
<entry feature="ide.settings.Gerrit" count="4" />
<entry feature="ide.settings.Java" count="1" />
<entry feature="ide.settings.Keymap" count="12" />
<entry feature="ide.settings.Vim_Emulation" count="2" />
<entry feature="idea.caches.invalidated" count="1" />
<entry feature="ideaapp.started" count="28" />
<entry feature="terminal.linux" count="2" />
<entry feature="uml.ShowDiagram.JAVA" count="1" />
<entry feature="welcome.screen.WelcomeScreen.Configure" count="1" />
<entry feature="welcome.screen.WelcomeScreen.CreateNewProject" count="2" />
</counts>
</component>
</application>

我在 StackOverflow 上发现有人上周遇到了类似的问题:My Activity Class turn into an xml file但是,对于发生的事情没有任何解决方案或解释。我在这里发现了另一个遇到同样问题的人:Android Studio wrong load a source file

现在它已经第三次发生在我身上了——这次它影响了 res/anim 中的一个 XML 文件。这真是令人费解(而且令人担忧,因为我现在很偏执,它会再次发生)。奇怪的是,文件内容在标记的中途被截断了:

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AnalysisUIOptions">
<option name="SCOPE_TYPE" value="3" />
</component>
<component name="AndroidLayouts">
<shared>
<config>
<devices>
<device id="Nexus 6" />
<device id="pixel" />
<device id="Nexus 4" />
<device id="tv_720p" />
<device id="tv_1080p" />
<device id="wear_round_chin_320_290" />
<device id="Galaxy Nexus" />
<device id="Nexus One" />
</devices>
</config>
</shared>
</component>
<component name="AndroidLogFilters">
<option name="TOOL_WINDOW_LOG_LEVEL" value="verbose" />
<option name="TOOL_WINDOW_CONFIGURED_FILTER" value="Show only selected application" />
</component>
<component name="BookmarkManager">
<bookmar

还有其他人遇到过这个问题吗?知道是什么原因造成的吗?


当我打开 XML 文件时又发生了几次。 transition__dialog__slide_out_to_right.xml 替换为我之前处理的 FlagView.java 类的开头(请注意,Java 文件当时未打开,已经 2 个多小时了因为我一直在编辑它,而这段代码不在我的剪贴板中):

package co.company.app.views;


import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.support.v7.app.AppCompatDelegate;
import android.util.AttributeSet;
import android.

transition__dialog__slide_in_from_right.xml 已替换为以下部分 XML:

<application>
<component name="UsageTrigger">
<counts>
<entry feature="CreateFile.CreateFileAction" count="2" />
<entry feature="execute.AndroidRunConfigurationType.Debug" count="14" />
<entry feature="execute.AndroidRunConfigurationType.Run" count="2237" />
<entry feature="execute.GradleRunCon

其他过渡动画文件正常打开。但是,res/anim 中的另一个文件被替换为我的大部分加拿大国旗可绘制 XML 文件:

<!-- Canadian flag -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="24dp"
android:viewportWidth="1000.0"
android:viewportHeight="500.0">

<!-- Background red rectangle -->
<path
android:fillColor="#f00"
android:pathData="M 0,0 L 1000,0 L 1000,500 L 0,500"
/>

<!-- Center white square -->
<path
android:fillColor="#fff"
android:pathData="M250,0 H750 V500 H250"
/>

<!-- Maple leaf -->
<path
android:fillColor="#ff0000"
android:pathData=
"
M 499.992280, 46.87500
-34.113120, 63.62529
c -3.870860, 6.91501
-10.806270, 6.27363
-17.741690, 2.41138
l -24.696990, -12.78858
18.407050, 97.72711
c 3.870860, 17.85419
-8.548590, 17.85419
-14.67765, 10.13435
l -43.101050, -48.25099
-6.997380, 24.50300
c -0.806920, 3.21777
-4.354810, 6.59744
-9.677480, 5.79261
l -54.501770, -11.45912
14.315240, 52.04475
c 3.064510, 11.58054
5.454900, 16.37528
-3.09375, 19.42959
l -19.426190, 9.13025
93.821270, 76.20838
c 3.713500, 2.88151
5.589710, 8.06700
4.267680, 12.76210
l -8.211360, 26.94707
c 32.304050, -3.72371
61.248980, -9.32594
93.569390, -12.77619
2.853230, -0.30459
7.629880, 4.40408
7.610290, 7.71058
l -4.280240, 98.72342
15.706390, 0
-2.472370,

非常奇怪...


我关闭了 Android Studio,当我重新打开它时,它使用的是默认的浅色主题,而不是我的深色主题。屏幕右侧出现错误列表。我关闭了应用程序并重新打开它。这次我收到一个弹出窗口,提示“启动失败”:

Internal Error. Please report to https://code.google.com/p/android/issues

com.intellij.ide.plugins.PluginManager$StartupAbortedException: Fatal error initializing 'com.intellij.psi.PsiDocumentManager'
at com.intellij.ide.plugins.PluginManager.handleComponentError(PluginManager.java:248)
at com.intellij.openapi.components.impl.PlatformComponentManagerImpl.handleInitComponentError(PlatformComponentManagerImpl.java:43)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter.getComponentInstance(ComponentManagerImpl.java:536)
at com.intellij.openapi.components.impl.ComponentManagerImpl.createComponents(ComponentManagerImpl.java:119)
at com.intellij.openapi.components.impl.ComponentManagerImpl.init(ComponentManagerImpl.java:103)
at com.intellij.openapi.components.impl.ComponentManagerImpl.init(ComponentManagerImpl.java:90)
at com.intellij.openapi.project.impl.ProjectImpl.init(ProjectImpl.java:285)
at com.intellij.openapi.project.impl.ProjectManagerImpl.initProject(ProjectManagerImpl.java:222)
at com.intellij.openapi.project.impl.ProjectManagerImpl.lambda$getDefaultProject$2(ProjectManagerImpl.java:280)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:494)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:443)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:198)
at com.intellij.openapi.project.impl.ProjectManagerImpl.getDefaultProject(ProjectManagerImpl.java:277)
at com.intellij.ide.fileTemplates.FileTemplateManager.getDefaultInstance(FileTemplateManager.java:67)
at com.android.tools.idea.startup.AndroidStudioInitializer.setUpNewProjectActions(AndroidStudioInitializer.java:270)
at com.android.tools.idea.startup.AndroidStudioInitializer.run(AndroidStudioInitializer.java:97)
at com.android.tools.idea.AndroidInitialConfigurator.activateAndroidStudioInitializerExtensions(AndroidInitialConfigurator.java:198)
at com.android.tools.idea.AndroidInitialConfigurator.<init>(AndroidInitialConfigurator.java:65)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.picocontainer.defaults.InstantiatingComponentAdapter.newInstance(InstantiatingComponentAdapter.java:193)
at org.picocontainer.defaults.ConstructorInjectionComponentAdapter$1.run(ConstructorInjectionComponentAdapter.java:220)
at org.picocontainer.defaults.ThreadLocalCyclicDependencyGuard.observe(ThreadLocalCyclicDependencyGuard.java:53)
at org.picocontainer.defaults.ConstructorInjectionComponentAdapter.getComponentInstance(ConstructorInjectionComponentAdapter.java:248)
at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.getComponentInstance(CachingConstructorInjectionComponentAdapter.java:58)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter.getComponentInstance(ComponentManagerImpl.java:495)
at com.intellij.openapi.components.impl.ComponentManagerImpl.createComponents(ComponentManagerImpl.java:119)
at com.intellij.openapi.application.impl.ApplicationImpl.lambda$createComponents$8(ApplicationImpl.java:429)
at com.intellij.openapi.progress.impl.CoreProgressManager$3.run(CoreProgressManager.java:170)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:494)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:443)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:155)
at com.intellij.openapi.application.impl.ApplicationImpl.createComponents(ApplicationImpl.java:436)
at com.intellij.openapi.components.impl.ComponentManagerImpl.init(ComponentManagerImpl.java:103)
at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:392)
at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:384)
at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:196)
at com.intellij.idea.MainImpl$1.lambda$null$0(MainImpl.java:47)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:358)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
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)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.intellij.openapi.util.ActionCallback
at com.intellij.openapi.application.impl.LaterInvocator.invokeLater(LaterInvocator.java:137)
at com.intellij.openapi.application.impl.ModalityInvokatorImpl.invokeLater(ModalityInvokatorImpl.java:46)
at com.intellij.openapi.application.impl.ApplicationImpl.invokeLater(ApplicationImpl.java:379)
at com.intellij.openapi.application.impl.ApplicationImpl.invokeLater(ApplicationImpl.java:369)
at com.intellij.openapi.application.impl.ApplicationImpl.invokeLater(ApplicationImpl.java:364)
at com.intellij.psi.impl.DocumentCommitThread.<init>(DocumentCommitThread.java:100)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.picocontainer.defaults.InstantiatingComponentAdapter.newInstance(InstantiatingComponentAdapter.java:193)
at org.picocontainer.defaults.ConstructorInjectionComponentAdapter$1.run(ConstructorInjectionComponentAdapter.java:220)
at org.picocontainer.defaults.ThreadLocalCyclicDependencyGuard.observe(ThreadLocalCyclicDependencyGuard.java:53)
at org.picocontainer.defaults.ConstructorInjectionComponentAdapter.getComponentInstance(ConstructorInjectionComponentAdapter.java:248)
at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.getComponentInstance(CachingConstructorInjectionComponentAdapter.java:58)
at com.intellij.openapi.components.impl.ServiceManagerImpl$MyComponentAdapter.getComponentInstance(ServiceManagerImpl.java:232)
at com.intellij.util.pico.DefaultPicoContainer.getLocalInstance(DefaultPicoContainer.java:246)
at com.intellij.util.pico.DefaultPicoContainer.getComponentInstance(DefaultPicoContainer.java:212)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.picocontainer.defaults.ImmutablePicoContainerProxyFactory.invoke(ImmutablePicoContainerProxyFactory.java:73)
at com.sun.proxy.$Proxy43.getComponentInstance(Unknown Source)
at com.intellij.util.pico.DefaultPicoContainer.getComponentInstance(DefaultPicoContainer.java:217)
at org.picocontainer.defaults.BasicComponentParameter.resolveInstance(BasicComponentParameter.java:77)
at org.picocontainer.defaults.ComponentParameter.resolveInstance(ComponentParameter.java:114)
at org.picocontainer.defaults.ConstructorInjectionComponentAdapter.getConstructorArguments(ConstructorInjectionComponentAdapter.java:257)
at org.picocontainer.defaults.ConstructorInjectionComponentAdapter$1.run(ConstructorInjectionComponentAdapter.java:217)
at org.picocontainer.defaults.ThreadLocalCyclicDependencyGuard.observe(ThreadLocalCyclicDependencyGuard.java:53)
at org.picocontainer.defaults.ConstructorInjectionComponentAdapter.getComponentInstance(ConstructorInjectionComponentAdapter.java:248)
at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.getComponentInstance(CachingConstructorInjectionComponentAdapter.java:58)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter.getComponentInstance(ComponentManagerImpl.java:495)
... 54 more

Android Studio 似乎出现了严重错误...

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com