gpt4 book ai didi

android - Android Studio Gradle Sync错误:找不到名称为 'default'的配置

转载 作者:行者123 更新时间:2023-12-03 06:16:09 25 4
gpt4 key购买 nike

我正在使用BottomSheet库来创建BottomSheet menu,如Google文档中所述。

我将BottomSheet库添加到我的项目中,但是当我与gradle同步时,我会收到错误消息。我尝试了Error: Configuration with name 'default' not found in Android Studio列出的所有答案以及stackoverflow上列出的其他解决方案,但问题仍然存在。

这是我的项目的build.gradle和设置文件:

BottomSheet / build.gradle

buildscript {
repositories {
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}

allprojects {
group = POM_GROUP_ID
version = POM_VERSION

repositories {
jcenter()
}

tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
}


task wrapper(type: Wrapper) {
gradleVersion = '1.12'
}

app / build.gradle
apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
applicationId "com.example.khsingh.stockysingh"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile "com.android.support:appcompat-v7:21.0.+"
compile project(":BottomSheet")



}

root / 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:1.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

}
}

allprojects {
repositories {
jcenter()
}
}

settings.gradle
include ':app', ':BottomSheet'
project(':BottomSheet').projectDir = new File('library/BottomSheet')

最佳答案

将此添加到您的app/build.gradle

compile 'com.cocosw:bottomsheet:1.+@aar'

无论如何,如果您想在应用程序中包含完整的library inc源代码,请按照以下说明下载库源代码:

  1. Right click on your app's root in android Studio (left view)
  2. Select "Open Module Settings"
  3. Select the "+" icon on the top left of the new Window
  4. Select "import from gradle/eclipse project".


现在该库应该在您的工作区中。

  1. Select your app from the list of modules
  2. Click on "Dependencies"
  3. Click on the green "+" on the right and select "library dependency"
  4. Select the BottomSheets library
  5. Apply


Android Studio现在应该自动将库插入您的应用并成功同步

关于android - Android Studio Gradle Sync错误:找不到名称为 'default'的配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30600699/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com