【发布时间】:2024-04-26 21:35:01
【问题描述】:
我想知道您是否可以提供帮助,我不是一个非常有经验的开发人员,但我在 Android 开发中尝试过。我正在使用使用 gradle 的 Android Studio。我收到以下编译错误:
Gradle:配置项目 ':HelloWorld' 时出现问题。
未能通知项目评估侦听器。 未找到名称为“默认”的配置。
我的文件夹结构是:
HelloWorldProject
.HelloWorld
.libraries
..facebook
..build.gradle
.src
..main
..build.gradle
...java
....com.helloworld
.....firstPage
.gradle
..wrapper
...gradle-wrapper.jar
...gradle-wrapper.properties
.build.gradle
.settings.gradle
.gradle.properties
我在根目录下的 ./build.gradle 是空的
我的 ./setting.gradle 文件包含:
include ':libraries:facebook', ':HelloWorld'
我的 ./HelloWorld/build.gradle 是:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
dependencies {
dependencies {
compile project(':libraries:facebook')
}
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 14
targetSdkVersion 16
}
}
我的 ./HelloWorld/src/build.gradle 包含:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
dependencies {
dependencies {
compile project(':libraries:facebook')
}
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 14
targetSdkVersion 16
}
}
【问题讨论】:
-
最近几天我因为 gradle 相关的问题而疯狂。我认为,如果您的项目不是那么大,您应该从头开始创建一个新项目,通过 File -> new component 菜单添加您的组件,并在几分钟内运行一个项目。你不会明白问题出在哪里,但是在这个早期的 gradle an android studio 中有这么多的错误和变化,不值得花太多时间在这些问题上。
标签: gradle android-studio build.gradle