How to restore build.gradle and .Gradle folder

2019-07-29 00:34发布

When I was trying to solve an issue with Android Studio I accidentally deleted .Gradle folder at the top of the project and build.gradle from within the app. I will post a screen shot of my project in Android Studio. The build tab also produces "make module my app project name" and "deploy module to app engine". The usual clean project, rebuild.... are not there.

enter image description here

How can I restore them?

3条回答
我欲成王,谁敢阻挡
2楼-- · 2019-07-29 01:01

You just need to reimport your project it will by default create the new gradle folder

查看更多
等我变得足够好
3楼-- · 2019-07-29 01:11

If your are not using a VCS:

  • try use the local history to recovery the build.gradle file in your root folder (right click on the root folder)

  • If it fails. you can create a new project and copy the build.gradle. Usually this file contains generic info (like android gradle pluging and the repos to be used in the modules)

  • the .gradle folder is not a problem. Gradle wrapper will recreate this file

查看更多
在下西门庆
4楼-- · 2019-07-29 01:12

I copied both from a different project and pasted them in my project. That didn't solve the problem and I imported the project File->new->import project but that only created a duplicate within my project. I closed the project and deleted it from the list of project in Android studio. Then I created a project by importing it from Android Studio Projects folder. It took forever stuck in the gradle build and I have to restart AS manually. Now I have all my files and the project is compiling as it should.

查看更多
登录 后发表回答