1

Im new to android development and ive seen some old tutorials before regarding its development on Eclipse. i recently download the new Android Studio to use for the development. However, i found something new called gradle files that are present in the projects folder along with the normal files that used to be in the project.

Everytime i try to run the app i get the following error:

" Gradle: FAILURE: Could not determine which tasks to execute. * What went wrong: Task 'assemble' not found in root project 'SampleProject'. * Try: Run gradle tasks to get a list of available tasks. "

Could anyone please explain whats the use of gradle? and do i have to use it while developing android apps?

Thank you

Amr Tharwat
  • 251
  • 1
  • 2
  • 10
  • 2
    If you are "new to android development", IMHO you should **NOT** be using Android Studio yet: http://commonsware.com/blog/2013/05/16/android-studio-early-access-preview-and-you.html – CommonsWare Jul 17 '13 at 20:54
  • @CommonsWare Why they did release the studio that early, was it a management pressure or what? Using gradle is a great thing in itself but the IntelliJ adds much to the confusion. – Alexander Kulyakhtin Jul 17 '13 at 21:00
  • @Alex: "Why they did release the studio that early" -- because there are lots of people who are not "new to android development" who can provide feedback. – CommonsWare Jul 17 '13 at 21:05
  • @CommonsWare Ive been developing on eclipse for 2 years now.. so do u still think i shouldnt use Android Studio? – Amr Tharwat Jul 17 '13 at 21:06
  • @CommonsWare plus if not... what do u recommend developing android apps on.. Eclipse or IntelliJ IDEA ? – Amr Tharwat Jul 17 '13 at 21:08
  • @Tharwat: "Ive been developing on eclipse for 2 years now.. so do u still think i shouldnt use Android Studio?" -- I would recommend that you stick to Eclipse, probably through the end of 2013. By then, not only will Android Studio be more mature, but you will have more Android experience and will be in better position to deal with any lingering Android Studio issues. – CommonsWare Jul 17 '13 at 21:09
  • @CommonsWare therefore i dont need to bother myself with gradle and all this?? – Amr Tharwat Jul 17 '13 at 21:10
  • @CommonsWare Android Studio has a lot of nice features as has been presented at Google I/O and yet we are not to use them? What's that a teasing of a kind? – Alexander Kulyakhtin Jul 17 '13 at 21:11
  • @Alex yea, the studio is mooooore better than eclipse with nice features.. thats why its sad that we cant use it – Amr Tharwat Jul 17 '13 at 21:14
  • You can use it! You must know that with Eclipse you can make an easier start... w/ android studio you have to try harder... sometimes may its your fault, sometimes not! If you insist, you 'll find it better, even if its in alpha/beta! – Paschalis Jul 17 '13 at 21:17
  • "therefore i dont need to bother myself with gradle and all this?" -- not yet. You can separately experiment with the new Gradle-based build system for command-line work, but that too is a work in progress, and I would not recommend that either for newcomers to Android. "the studio is mooooore better than eclipse with nice features" -- it is also seriously limited in many areas where they have not built out all the functionality yet. – CommonsWare Jul 17 '13 at 21:17
  • @Tharwat Yeah, we are told to provide feedback. As if we are at some mayor elections hearing some candidates. They should not have presented it if it's not ready as simple as that. – Alexander Kulyakhtin Jul 17 '13 at 21:18
  • They could have presented Gradle only. In fact there were 2 presentations exactly because of that. Gradle rules, Studio is not ready yet. I'm switiching to the command line – Alexander Kulyakhtin Jul 17 '13 at 21:19
  • @CommonsWare one more thing.. for the IDEs. Do u recommend using Eclipse or IntelliJ IDEA ?? and why? thanks :) – Amr Tharwat Jul 18 '13 at 00:11
  • @Tharwat: Either is fine. Since you already know Eclipse, you might consider starting with that, until you get some Android experience. If, OTOH, you would rather go with IDEA to make moving to Android Studio easier (as Studio is based on IDEA), that would also be reasonable. – CommonsWare Jul 18 '13 at 10:34
  • @CommonsWare thank you for ur response.. ill definitely consider IDEA,, looks neat – Amr Tharwat Jul 19 '13 at 02:29

3 Answers3

1

In your top directory file with name build.gradle just put:

task assemble {}

You can see it in known issues here

Get started with gradle here!

Edit: Android Studio 0.2.1 solves this error: http://tools.android.com/recent/androidstudio021released

Paschalis
  • 11,929
  • 9
  • 52
  • 82
  • Thank you.. ill check the links – Amr Tharwat Jul 18 '13 at 00:12
  • Really don't do that. This is just a hack that ignores the fact that the build will not work. – Xavier Ducrohet Jul 19 '13 at 00:13
  • @Xav I wasn't talking about the cases that the build had errors. I was talking about a bug I read on G+ or somewhere on Android Studio release notes! btw 0.2.1 released, and this I was talking about seems to be fixed: http://tools.android.com/recent/androidstudio021released PS are you a Google employee? :D – Paschalis Jul 19 '13 at 00:32
1

Version 0.2.1 of Studio was just released and provides a better error. You should upgrade and see what happens, but it's likely that your project has another problem that should be fixed instead of randomly adding a task that shouldn't be added.

Xavier Ducrohet
  • 28,383
  • 5
  • 88
  • 64
0

Android Studio is bleeding edge (not yet beta).

For more stable solution use Eclipse with ADT, e.g. ADT-bundle http://developer.android.com/sdk/index.html

You can develop in Eclipse with ADT and run Gradle build using Nodeclipse/Enide Gradle for Eclipse (marketplace)

Some screenshots for Gradle for Eclipse:

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