Search code examples
androideclipsegradleandroid-gradle-pluginbuildship

How to run the 'gradle init' task in Eclipse Buildship plugin?


I want to use Gradle for my Android project, and I use Eclipse (rather than Android Studio). My web-search pointed me to Eclipse's Gradle Plugin called Buildship. I downloaded and installed it following this guide.

My need is to convert my Android project in my Eclipse workspace into something that works with Gradle build system. So following this section of the guide mentioned, I added Gradle support to my project. But I still can not see a build.gradle file in my project. I did refresh the project.

So what do I do to get a build.gradle file in my project?

enter image description here

*The guide I linked to says, *

Run the 'gradle init' task to create the initial Gradle files, in case you do not have them yet.

but I can't figure out how to run the gradle init task.


Solution

  • In the "Gradle Tasks" panel, expand the node of your project. Then expand the "build setup" node. Right click on "init" and select "Run Gradle Tasks".

    Then in the project explorer, right click on your project and select "Gradle", then select "Refresh Gradle Project". And voila! You must be able to see your build.gradle now.