简体   繁体   English

Build.gradle 文件损坏

[英]Build.gradle files corrupted

I have opened one of my projects after a month, and all the gradle scripts seems to have been affected.一个月后我打开了我的一个项目,所有gradle脚本似乎都受到了影响。 All the code of build.gradle files( both app and module level) is gone. build.gradle 文件(应用程序和模块级别)的所有代码都消失了。 I tried running the app on my phone ,it gave the following error Manifest Merger failed , i tried the solution mentioned by Vishrut Mavani and app worked fine.我尝试在手机上运行该应用程序,但出现以下错误Manifest Merger failed ,我尝试了 Vishrut Mavani 提到的解决方案,应用程序运行良好。 But my question is what happened to all the code in build.gradle files.但我的问题是 build.gradle 文件中的所有代码发生了什么。 I had implemented many dependencies, if code is gone, how the app is still working?我已经实现了许多依赖项,如果代码消失了,应用程序如何仍然工作?
I am posting the pictures of build.gradle files.我正在发布 build.gradle 文件的图片。 build.gradle 应用程序级别

build.gradle 模块级别

Other files in gradle scripts are also affected i think, but i am not sure.我认为 gradle 脚本中的其他文件也受到影响,但我不确定。 If anyone need the images, I will post them.如果有人需要图片,我会发布它们。

Try the following :尝试以下操作:

  1. In your Gradle file, right-click, from the popup menu select Local History > Show History , from the Old Changes list, select an old change from a month ago, copy your code from there and paste into the Gradle file.在您的 Gradle 文件中,右键单击,从弹出菜单中选择Local History > Show History ,从Old Changes列表中,选择一个月前的旧更改,从那里复制您的代码并粘贴到 Gradle 文件中。

  2. Android Studio > Build > Clean Project & Android Studio > Build > Rebuild Project Android Studio > Build > Clean Project & Android Studio > Build > Rebuild Project

  3. Android Studio > File > Invalidate Caches/Restarts... Android Studio > 文件 > 使缓存无效/重新启动...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM