1

How can I add a gradle nature to my eclipse android project while keeping the eclipse structure directory layout?

Can I do this with gradle ide for eclipse plugin by spring?

Ramsharan
  • 2,054
  • 2
  • 22
  • 26
ThanosFisherman
  • 5,626
  • 12
  • 38
  • 63

3 Answers3

0

Yes thats possible and well documented:

To replace the default source folders, you will want to use srcDirs instead, which takes an array of path. This also shows a different way of using the objects involved:

sourceSets {
    main.java.srcDirs = ['src/java']
    main.resources.srcDirs = ['src/resources'] }

See also: How to configure build.gradle files of an existing project with actionbarsherlock lib?

Just my 2 cents: you wont make yourself a favor trying to config eclipse to work with gradle, just make your life easier and use the tooling recommended by google.

Community
  • 1
  • 1
Patrick
  • 33,984
  • 10
  • 106
  • 126
  • Thank you for your suggestion and for the Documentation page. But what is that recommended tooling by google you are refering to? – ThanosFisherman Oct 30 '14 at 03:44
  • That's the thing I don't want to use android studio yet cause I need ndk support and standar java projects. Istead I'm going to take a look at the doc provided and try the eclipse gradle plugin – ThanosFisherman Oct 30 '14 at 14:40
  • I dont know what the table on the doc means by "no ndk support" but gradle has ndk support (see http://stackoverflow.com/questions/20674650/how-to-configure-ndk-with-android-gradle-plugin-0-7) altought I dont know if there a limitations, I guess the IDE UI support is not there yet (but I mean thats the same as using eclipse with gradle then) and if you need java projects just use intellij with the android plugin (which is the same as android studio see http://blog.jetbrains.com/idea/2013/05/intellij-idea-and-android-studio-faq/) – Patrick Oct 30 '14 at 15:24
0

an official migrating guide will helps you.
https://developer.android.com/sdk/installing/migrate.html

ytRino
  • 1,450
  • 15
  • 28
0

As of 1.0 of android gradle plugin is still incompatible with java and eclipse gradle plugins.

So if you literally add gradle nature to your eclipse android project, it will likely to break.

However you can add build.gradle and run gradle build from within Eclipse as secondary build.

see http://www.nodeclipse.org/projects/gradle/

Paul Verest
  • 60,022
  • 51
  • 208
  • 332