19

I am trying to import eclipse project into android studio, but its giving this error.

Could not fetch model of type 'IdeaProject' using Gradle installation 'D:\gradle-1.7'.
A problem occurred configuring root project 'HealthCity'.
A problem occurred configuring root project 'HealthCity'.
Failed to notify project evaluation listener.
Configuration with name 'default' not found.

the same error is there when i try to manually build the project.

below is my settings.gradle

include ':ActionBarSherlock',':FacebookSDK',':library',':NineOldAndroids',':google-play-services_lib',':viewflow'

project(':ActionBarSherlock').projectDir = new File('C:/Users/Ankit/workspace/workspace-client-gemoro-2/ActionBarSherlock')
project(':FacebookSDK').projectDir = new File('C:/Users/Ankit/workspace/workspace-client-gemoro-2/FacebookSDK')
project(':library').projectDir = new File('C:/Users/Ankit/workspace/workspace-client-gemoro-2/library')
project(':NineOldAndroids').projectDir = new File('C:/Users/Ankit/workspace/workspace-client-gemoro-2/NineOldAndroids')
project(':google-play-services_lib').projectDir = new File('C:/Users/Ankit/workspace/workspace-client-gemoro-2/google-play-services_lib')
project(':viewflow').projectDir = new File('C:/Users/Ankit/workspace/workspace-client-gemoro-2/viewflow')

here is my build.gradle

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.5+'
    }
}
apply plugin: 'android'

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile project(':ActionBarSherlock')
    compile project(':FacebookSDK')
    compile project(':library')
    compile project(':NineOldAndroids')
    compile project(':google-play-services_lib')
    compile project(':viewflow')
}

android {
    compileSdkVersion 16
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 16
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        instrumentTest.setRoot('tests')
    }
}
Ankit
  • 6,554
  • 6
  • 49
  • 71

1 Answers1

46

So, you need to make sure that each submodule in your project has its own build.gradle file. The name 'default' happens because your outer build.gradle is trying to build a project that doesn't know how to build itself, thus it is given the name 'default.' Try doing that and see what happens.

astryk
  • 1,256
  • 13
  • 20
  • 3
    What do those build.gradle files need to contain? – IgorGanapolsky Jan 15 '14 at 21:07
  • 2
    http://tools.android.com/tech-docs/new-build-system/user-guide is a great resource I used for all things android-gradle. Essentially the build.gradle file for each submodule needs to have the information on how to build itself and any custom gradle command definitions. – astryk Jan 16 '14 at 21:51
  • 2
    good point, thanks! in my case the problematic submodule was an empty folder (a git submodule that i had to pull first). – mircealungu May 09 '15 at 23:57
  • 3
    You Genius "each submodule in your project has its own build.gradle file" . Thanks. – CoDe Aug 21 '15 at 13:32
  • 1
    What if each submodule in my project doesn't have its own built.gradle? – Zin Win Htet Aug 01 '16 at 08:56
  • The thing that clicked to me after reading this was that I was pointing to a multi-project build.gradle file instead of the specific project's I wanted from that multi-project. – Janis Peisenieks Aug 23 '16 at 08:25
  • it worked thanks , In my project the problem was with settings.gradle file – Sunil Kumar Nov 01 '17 at 12:02