我是 Android Studio 的新手,所以不知道 gradle 是如何工作的。也许这是一个愚蠢的问题。
每当我尝试将 GitHub 项目作为模块导入到我的项目中并尝试构建该项目时,我总是会收到此错误:
Could not find property 'GROUP' on project build.gradle
我知道小组需要识别项目名称。我试图找到这个问题的答案,但没有太多引用资料,所以我将问题发布在这里。
最近我尝试将 Fresco 作为模块导入到项目中,但遇到了同样的错误。
问题是
- 为什么我会收到此错误?
- gradle如何构建项目?
这是我的 build.gradle:
apply plugin: 'com.android.library'
apply plugin: 'maven'
project.group = GROUP
version = VERSION_NAME
dependencies {
compile "com.android.support:support-v4:${SUPPORT_V4_VERSION}"
provided "com.google.code.findbugs:jsr305:${JSR_305_VERSION}"
provided "javax.annotation:javax.annotation-api:${ANNOTATION_API_VERSION}"
compile project(':fbcore')
testCompile "junit:junit:${JUNIT_VERSION}"
testCompile "org.mockito:mockito-core:${MOCKITO_CORE_VERSION}"
testCompile("org.robolectric:robolectric:${ROBOLECTRIC_VERSION}") {
exclude group: 'commons-logging', module: 'commons-logging'
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
}
apply from: rootProject.file('release.gradle')
android {
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdkVersion rootProject.ext.compileSdkVersion
packagingOptions {
exclude 'NOTICE'
exclude 'LICENSE'
exclude 'LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
}
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
artifacts.add('archives', sourcesJar)
最佳答案
将 GROUP
和 VERSION_NAME
替换为实际值,例如:
project.group = 'the.group.of.my.module'
version = '1.0'
编辑:您可以编写 value project.group 任何内容。但它应该是唯一的并标识您的模块名称。就我而言,我写了 project.group = 'com.facebook.fresco'
希望它能帮助 future 的访客并节省他们的时间。
归功于@Henry
关于android - 在项目名称文件 : build. gradle 上找不到属性 'GROUP',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34963384/