Android Studio 3.2.1 不断损坏奇怪的 XML 上的 Java 文件 [英] Android Studio 3.2.1 keeps corrupting Java files on weird XML

查看:29
本文介绍了Android Studio 3.2.1 不断损坏奇怪的 XML 上的 Java 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Android Studio 上随机崩溃后,我的很多代码都被 Android Studio 打开,就好像它是一个 XML 或 R.class.

After a random crash on Android Studio, a lot of my code is being opened by Android Studio as if it was an XML or R.class.

损坏文件 1 示例

损坏文件 2 示例

更好地解释它:它在全新安装 Android Studio(任何版本)后会自行纠正,并且在 3.1.4 中没有发生过,但我使用的是 3.2 中的功能.编码不到 6 小时后,Android 上发生了随机崩溃,我向 AS 报告了它,这突然发生在我的许多文件中,在我完全重新安装 Android 之前不允许我再次构建它.

Explaning it better: It does correct itself after a fresh install of Android Studio (any version), and it hasn't happened in 3.1.4, but I'm using features from 3.2. After less than 6h coding, a random crash happens on Android, I report it by the AS and this suddenly happens to many of my files, not allowing me to build it again until I reinstall Android entirely.

我以管理员身份运行 AS,并且我在任何地方都拥有权限.我的项目也没有损坏,我的文件也没有损坏,因为每次全新安装只会将我的代码带回来,我可以编码,直到发生任何/随机崩溃,造成这种 AS/Gradle 损坏.

I'm running AS as an Administrator, and I do have permission everywhere. My project is not corrupted nor are my files, since every single fresh install simply brings my code back and I can code until any/a random crash happens, creating this AS/Gradle corruption.

如您所知,即使在 AS 上损坏",我的代码在打开时实际上也很好使用任何外部编辑器,所以恢复我的 Git 代码不足以让我摆脱这个问题(我希望).

As you can tell, even when "corrupted" on AS, my code is actually fine when opened with any external editor, so reverting back my Git code is not enough to make me get rid of this problem (I wish).

一些我已经尝试过的重要事情:

Some important things I already tried:

  • 清除缓存并重启 Android Studio
  • 使用 Android 3.2.1 和 3.3 RC
  • 重建项目
  • 与 Gradle、FileSystem 等重新同步...
  • 清除来自 /user/.gradle/caches 和来自 /user/.AndroidStudio3.3/system/caches
  • 的缓存
  • 从项目文件夹中删除 .idea 和 .gradle
  • 重新安装 Android Studio(也尝试了两个版本)

我在这里发现了一个相关的问题,但这个人只是删除了这两个文件.但这是我做不到的,因为我的项目文件正在发生这种情况.可以在此处找到此相关问题.

I found a related issue here, but the guy simply deleted both of those files. But that's something I can't do, since this is happening with my project files. This related issue can be found here.

我还发现了另外 3 或 4 个帖子,这些帖子从未以有效答案回答,并且从未解决"或通过安装新版本的 AS 解决.但我已经在尝试 Beta 版了,这个错误/问题仍然存在......

I also found another 3 or 4 posts, which where never answered with a valid answer and that were "never solved" or were solved by installing a new version of AS. But I'm already trying the Beta and this error/problem persists....

将此帖子视为寻求帮助的呼声.这在我的开发过程中一直困扰着我,以至于在每个和任何更新版本的 AS 中出现这种奇怪的行为之前,我根本无法编程超过 6 个小时.

Consider this post a cry for help. This is haunting me in my development in such a way that I simply can't program more than 6 hours before getting this bizarre behavior in each and any newer version of AS.

参考:

相关@@文加特

@CanProgram 相关 (从 2.3.3 开始?)

Related by @CanProgram (since 2.3.3?)

@RmGetty Bautista 相关

与 KeepCoding 相关

推荐答案

Tbh,android studio 在这方面很烂.如果你遇到那个问题,那么 r.i.p 到你的代码.我试图将文件损坏的可能性降到最低的方法是在我运行完程序时关闭模拟器,并且当它正常工作时,我将所有文件复制到记事本,以防万一发生不好的事情.*是的,当我想在讲师面前展示我的作业时,它发生了,多亏了记事本,我可以取回它

Tbh, android studio sucks at that part. If you encounter that problem, then r.i.p to your code. The way I tried to minimized the chance of getting my file corrupted is by closing the emulator whenever I finished running the program, and also when it works properly, I copy all the files to a notepad just in case something bad happen. *and yes it happened right when I wanted to show my assignment in front of my lecturer, thanks to notepad I can retrieve it back

这篇关于Android Studio 3.2.1 不断损坏奇怪的 XML 上的 Java 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆