未找到名称为“默认"的配置.安卓工作室

Configuration with name #39;default#39; not found. Android Studio(未找到名称为“默认的配置.安卓工作室)
本文介绍了未找到名称为“默认"的配置.安卓工作室的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Android Studio 应用.它有一个库依赖项(Android-Bootstrap),当我尝试同步 gradle 时,它​​给了我一个错误:

I have an Android Studio app. It has a library dependency (Android-Bootstrap), when I try to sync gradle, it gives me an error:

未找到名称为默认"的配置.

Configuration with name 'default' not found.

我的结构是:

-FTPBackup
   -fotobackup
     -build.gradle
   -Libraries
     -Android-Bootstrap
       -Settings.gradle
       -build.gradle
-Settings.gradle
-Build.gradle

FTPBackup settings.gradle 和 build.gradle:

The FTPBackup settings.gradle and build.gradle:

include ':fotobackup'
include ':libraries:Android-Bootstrap',':Android-Bootstrap'

<小时>

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

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

allprojects {
    repositories {
        mavenCentral()
    }
}

而 fotobackup 里面的 build.gradle 是:

And the build.gradle inside fotobackup is:

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion '19.0.3'

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

apply plugin: 'android'

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:support-v4:+'
    compile project (':libraries:Android-Bootstrap')
}

库是从 https://github.com/Bearded-Hen/Android-下载的Bootstrap,它有 build.gradle,设置等.

The library is downloaded from https://github.com/Bearded-Hen/Android-Bootstrap and it has build.gradle, settings etc.

怎么了?

推荐答案

一方面,拥有多个 settings.gradle 文件并不好——它只查看顶部- 一级.

For one, it doesn't do good to have more than one settings.gradle file -- it only looks at the top-level one.

当您收到未找到名称为 'default' 的配置"错误时,这确实令人困惑,但这意味着 Gradle 正在某个地方寻找模块(或 build.gradle)文件,但没有找到它.在您的情况下,您的 settings.gradle 文件中有这个:

When you get this "Configuration with name 'default' not found" error, it's really confusing, but what it means is that Gradle is looking for a module (or a build.gradle) file someplace, and it's not finding it. In your case, you have this in your settings.gradle file:

include ':libraries:Android-Bootstrap',':Android-Bootstrap'

这使得 Gradle 在 FTPBackup/libraries/Android-Bootstrap 中寻找库.如果您使用的是区分大小写的文件系统(当您的意思是 libraries 时,您没有在问题中输入错误的 Libraries),它可能找不到 FTPBackup/库/Android-Bootstrap 因为大小写不同.它还在 FTPBackup/Android-Bootstrap 上寻找另一个库,但肯定找不到,因为那个目录不存在.

which is making Gradle look for a library at FTPBackup/libraries/Android-Bootstrap. If you're on a case-sensitive filesystem (and you haven't mistyped Libraries in your question when you meant libraries), it may not find FTPBackup/Libraries/Android-Bootstrap because of the case difference. It's also looking for another library at FTPBackup/Android-Bootstrap, and it's definitely not going to find one because that directory isn't there.

这应该可行:

include ':Libraries:Android-Bootstrap'

您的 dependencies 块中需要相同的区分大小写的规范:

You need the same case-sensitive spec in your dependencies block:

compile project (':Libraries:Android-Bootstrap')

这篇关于未找到名称为“默认"的配置.安卓工作室的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)