gpt4 book ai didi

android - 在 gradle 上构建 android 项目时找不到名称为 'default' 的配置

转载 作者:IT王子 更新时间:2023-10-28 23:28:33 28 4
gpt4 key购买 nike

我正在尝试将 eclipse 项目导入 android studio,但它给出了这个错误。

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.

当我尝试手动构建项目时出现同样的错误。

下面是我的 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')

这是我的 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')
}
}

最佳答案

因此,您需要确保项目中的每个子模块都有自己的 build.gradle 文件。之所以会出现“默认”名称,是因为您的外部 build.gradle 正在尝试构建一个不知道如何构建自身的项目,因此它被命名为“默认”。尝试这样做,看看会发生什么。

关于android - 在 gradle 上构建 android 项目时找不到名称为 'default' 的配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18178267/

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