Alex DG
Alex DG

Reputation: 1869

Migrate Eclipse project to Gradle

I'm trying to move my current android project to a Gradle project, so here what I've done so far:

  1. add gradle to eclipse
  2. generation of build.gradle file
  3. create ANDROID_HOME environment variable in Windows 7
  4. at the root of my project in command prompt: gradlew build

So now, I've got a new folders structure in my project:

Gradle project

It's my first time with gradle, I guess I missed something and I would like to know if to finish this migration I have to delete the src and res directories (in blue) ? For me I just have to get a new structure of folders after the generation of gradleview build.. And if what I've generated looks like to a gradle project ?

Upvotes: 1

Views: 2860

Answers (2)

Paul Verest
Paul Verest

Reputation: 63892

There was typo: use gradlew build or gradle build

You can keep Eclipse folder structure and configure it in build.gradle

Yet I would recommend to move source into src/main/java. Eclipse would be quite OK with that.

http://www.nodeclipse.org/projects/gradle/android/Make-Android-Eclipse-project-ready-for-Android-Studio

Upvotes: 0

Fabian
Fabian

Reputation: 2713

If your project structure does not fit to android studios structure you can add your folders to the source set in the gradle file of your app. So your android studio will match the correct folders

http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Project-Structure

sourceSets {
    main {
        // manifest.srcFile 'src/main/AndroidManifest.xml'
        // java.srcDirs = ['src/main/java', 'build/generated/source/apt/${variant.dirName}']
        // resources.srcDirs = ['src/main/resources']
        // res.srcDirs = ['src/main/res']
        // assets.srcDirs = ['src/main/assets']
    }
}

as copied from here

Upvotes: 1

Related Questions