-4

I just switched from Eclipse (API 18 JB) to Android Studio (LP 5.1v). First of all, "What the heck is gradle ?".The folders gen, bin, libs and src have seemed to be gone, Java files have migrated to a new folder. Only the 'res'seems to be in its place, whole. Please explain these things to me. Is the development here same as in the case of Eclipse.

P.S.(I made a project in Eclipse with target android -18, it is not there by default in the AS. What is the size of API 18 JB 4.3 if I download it via SDK updates.)

[I don't want theoretical answers, nor any links. Please provide some answers that may clarify my question.]

Oggy.Coder
  • 43
  • 8

1 Answers1

2

Gradle is a kind of "project build automation tool". You don't need to worry about it most of the time. Android Studio handles most of the editing of Gradle files for you.

If you really want to know what gradle really is, here's the tag wiki for :

Gradle is a project build automation tool that uses a Groovy DSL. Gradle build scripts support Maven and Ivy repositories as well as plain file system for dependency management.

Let me explain it.

So basically it is saying that Gradle can automate your build process blah blah blah and you can use it as a dependency manager. It is also a dependency manager so you can add Maven and Ivy repositories as dependencies of your project.

How do I add dependencies?

IMO, the method of adding a .jar file to libs should not be used in Android. You should add a line to your gradle files to add a dependency.

Here's how:

Find this fileenter image description here

and open it. In the dependencies block:

dependencies {
    ...
}

add your dependencies. For example,

dependencies {
    ...
    compile 'com.github.satyan:sugar:1.4'
}

The folders gen, bin, libs and src have seemed to be gone. Java files have migrated to a new folder.

Actually, only gen and bin are gone!

If you look at the thing on the left, you will probably see this:

enter image description here

But if you click the "Android" on the top there, and click "Project", you will see this:

enter image description here

Look! src and libs are back!

Sweeper
  • 213,210
  • 22
  • 193
  • 313