我刚在这个文件夹中安装了gradle:/Users/joanet/Development/gradle-2.3
编辑launchd.conf文件
sudo vim /etc/launchd.conf
设置变量GRAILS_HOME
setenv GRAILS_HOME /Users/joanet/Development/gradle-2.3
使用文件 - >导入项目
但我收到此错误: Gradle项目同步失败 , 错误:在Android Studio中找不到名称为“default”的配置

这里是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()
}
}
和/app/build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '22.0.0'
defaultConfig {
applicationId "no.nordicsemi.android.nrftoolbox"
minSdkVersion 18
targetSdkVersion 22
versionCode 30
versionName "1.12.1"
}
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 project(':..:DFULibrary:dfu')
compile files('libs/achartengine-1.1.0.jar')
compile files('libs/nrf-logger-v2.0.jar')
}
这里是settings.gradle:
include ':app', '..:DFULibrary:dfu'
这里是gradle-wrapper.properties:
#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
// 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()
}
}
在尝试导入新项目时,用户遇到了Android Studio中Gradle项目同步失败的问题,错误提示为找不到名为“default”的配置。用户已经设置了GRAILS_HOME环境变量,并提供了build.gradle、settings.gradle和gradle-wrapper.properties等配置文件内容。尽管如此,问题仍然存在,可能的原因是Gradle版本不匹配或者项目配置错误。

被折叠的 条评论
为什么被折叠?



