配置问题。 “未找到名称'default'的配置”

时间:2014-09-30 05:44:14

标签: android gradle android-studio

我对Android开发相对较新,对Android Studio非常陌生(使用Eclipse + android插件更有经验)。我正在尝试编辑一个github项目,但我似乎无法让它甚至编译!我一直在阅读,我的错误似乎与图书馆本身的build.gradle /位置有关。

我的错误是:

  

错误:未找到名称为“default”的配置。

它还说“Gradle项目同步失败,但我认为它与上述错误有关......无论这意味着什么。

我的外部build.gradle是:

// Top-level build file where you can add configuration options common to all sub- projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
            classpath 'com.android.tools.build:gradle:0.12.+'

            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

我的内部build.gradle文件是:

buildscript {
    repositories {
        maven { url 'http://download.crashlytics.com/maven' }
    }

    dependencies {
        classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'crashlytics'

repositories {
    maven { url 'http://download.crashlytics.com/maven' }
}


android {
compileSdkVersion 20
buildToolsVersion '20.0.0'

packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
}

defaultConfig {
    applicationId "com.wisely.loyalty"
    minSdkVersion 14
    targetSdkVersion 18
    versionCode 17
    versionName "1.0"
}
   buildTypes {
       release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
       }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':facebook')
    compile project(':cwac')
    // You must install or update the Support Repository through the SDK manager to use     this dependency.
    // You must install or update the Support Repository through the SDK manager to use this dependency.
    // You must install or update the Support Repository through the SDK manager to use this dependency.
    // You must install or update the Support Repository through the SDK manager to use this dependency.
    // You must install or update the Support Repository through the SDK manager to use this dependency.
    compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5'
    compile('org.apache.httpcomponents:httpmime:4.3.5') {
        exclude module: "httpclient"
}
    compile 'com.android.support:support-v13:20.0.0'
    compile 'com.google.android.gms:play-services:5.0.+'
    compile 'com.android.support:appcompat-v7:20.0.0'
    compile 'com.android.support:support-v4:20.0.0'
    compile 'com.google.code.gson:gson:2.2.4'
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.2'
    compile 'com.makeramen:roundedimageview:1.3.0'
    compile 'com.crashlytics.android:crashlytics:1.+'
}

编辑: 常规文件层次结构

root
    .idea
    app
       libs
           cwac
           fb
           utils
        src
         … all source files
    gradle
    build.gradle
    settings.gradle
External Libraries
    Android API 20 Platform
    JDK

编辑:Settings.gradle:

include ':app', ':facebook', ':cwac', ':utils'
project(':facebook').projectDir = new File('app/libs/facebook')
project(':cwac').projectDir = new File('app/libs/cwac')
project(':utils').projectDir = new File('app/libs/utils')

进度更新: 我试过在目录中移动库文件无济于事。我也试过使用我的eclipse环境,这似乎有更多的问题。我真的需要正确配置这个项目!

更新#2: 我有一种强烈的感觉,这与gradle版本有关,因为文件配置似乎很好,而且它可能是我的电脑缺少某些东西。我是新手使用gradle。有没有办法更新它?或者只是通过sdk管理器中的支持库进行更新?

1 个答案:

答案 0 :(得分:0)

将库文件夹添加到项目的根位置,并将所有库文件复制到那里。对于ex YourProject / library然后同步它