Android Studio 打开不正确的 java 类文件。错误 : "Failed linking the resources."

标签 android android-studio gradle

android studio中有10多个文件被错误打开。当我在文件夹中期待该文件并在记事本中打开时,我的代码是正确的。当在 android studio 中打开同一个文件时,文件包含不同的代码或类似(URL 数据的 Myworkspace 列表 - D:/Test Workspace/MyApplcation)

enter image description here

我做了无效的缓存并重新启动、重建、清理项目,但没有任何效果。
我的发展从此停止。

最佳答案

右键单击您的文件,选择

Local History > Show History

现在您可以看到您之前的更改,

Just copy your previous code and paste inside the current file.



可悲的是,您必须手动检查所有 java 文件并进行相应更改,否则 Android Studio 将无法运行您的项目。



如果您的项目与 git 同步,您可以使用以下命令重置代码:
git reset --hard HEAD
就我而言,它是通过这样做解决的。

希望能帮助到你!

关于Android Studio 打开不正确的 java 类文件。错误 : "Failed linking the resources.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53879568/

相关文章:

当使用 OpenCV CameraBridgeViewBase 时,Android 总是在随机时间间隔后重新启动

android - build 项目 : outOfMemory (Android studio 3. 4)

gradle - Gradle 3.5和Spring Boot的点符号

android adb shell script - 如何拉取所有共享首选项

android - 错误 : Attribute "***" has already been defined when using two library projects in Android

java - android项目的巨大java类,如何拆分它?

android - 无法修复 "Plugin with id ' 找不到 com.android.application'

android-studio - 编译错误: "-Xcoroutines has no effect: coroutines are enabled anyway in 1.3 and beyond"

java - 使用带有不同类内部代码的按钮

其他插件的 Gradle 食谱 "creating source and resource directories"