android - 配置问题。找不到 “Configuration with name '默认值”

标签 android gradle android-studio

我对Android开发比较陌生,对Android Studio则很陌生(对Eclipse + android插件有更多的经验)。我正在尝试编辑github项目,但似乎无法编译它!我一直在阅读,我的错误似乎与库本身的build.gradle / location有关。

我的错误是:

Error:Configuration with name 'default' not found.



它还说:“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管理器中的支持库进行更新?

最佳答案

将您的库文件夹添加到项目的根目录,然后将所有库文件复制到那里。对于以前的YourProject / library,然后将其同步

关于android - 配置问题。找不到 “Configuration with name '默认值”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26113554/

相关文章:

java - Intent.createChooser 安卓二维码阅读器

Android repo 初始化失败

Android,出现使我的应用程序崩溃的异常

jenkins - 如何通过Gradle任务使用Jenkins将WAR文件发布到Maven(Nexus)存储库

android - 分配给 Android Studio 的快捷方式不起作用

android - 字节序在不同设备上的行为是否不同

gradle - Gradle在一项任务中创建多种任务类型

android - 在android studio中创建新项目时出错

使用 Android Studio (IntelliJ) 的 Git mergetool

Android Studio 布局错误 : Unknown attribute