【发布时间】:2013-02-23 00:31:24
【问题描述】:
我正在将 andoirdannotations 集成到一个 gradle 构建过程到一个通用的 android 项目中。当我尝试通过添加 apply plugin: 'androidannotations 来构建项目时,出现以下错误:
$ gradle clean
FAILURE: Build failed with an exception.
* What went wrong:
Main Manifest missing from /tmp/RunTest/src/main/AndroidManifest.xml
注意(1):我想维护通用的android项目结构。 注意(2):我已经成功构建/清理了这个项目,没有 androidannotations 插件
build.gradle 文件:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.3'
classpath 'net.ealden.gradle.plugins:gradle-androidannotations-plugin:0.3.0'
}
}
apply plugin: 'android'
apply plugin: 'androidannotations'
repositories {
mavenCentral()
}
android {
def target = 'android-21'
def androidAnnotationsVersion = '2.7.1'
sourceSets {
main {
manifest {
srcFile 'AndroidManifest.xml'
}
java {
srcDir 'src'
}
res {
srcDir 'res'
}
assets {
srcDir 'assets'
}
resources {
srcDir 'src'
}
}
test {
java {
srcDir 'tests/src'
}
}
}
}
因此,我放弃了尝试维护通用 android 项目结构并将项目目录结构强制转换为此处指出的结构:http://tools.android.com/tech-docs/new-build-system/using-the-new-build-system。
正如预期的那样,这解决了我的Main Manifest missing from /tmp/RunTest/src/main/AndroidManifest.xml,但是我仍然没有得到快乐。
现在我得到了:
MyBox:RunTest $ gradle clean
Download http://repo1.maven.org/maven2/net/ealden/gradle/plugins/gradle-androidannotations-plugin/0.3.0/gradle-androidannotations-plugin-0.3.0.pom
Download http://repo1.maven.org/maven2/org/gradle/api/plugins/gradle-android-plugin/1.1.0/gradle-android-plugin-1.1.0.pom
Download http://repo1.maven.org/maven2/net/ealden/gradle/plugins/gradle-androidannotations-plugin/0.3.0/gradle-androidannotations-plugin-0.3.0.jar
Download http://repo1.maven.org/maven2/org/gradle/api/plugins/gradle-android-plugin/1.1.0/gradle-android-plugin-1.1.0.jar
FAILURE: Build failed with an exception.
* What went wrong:
Cannot add task ':processTestResources' as a task with that name already exists.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 9.28 secs
【问题讨论】:
-
请注意
AndroidAnnotations Gradle plugin已弃用且不再更新。只需使用android-apt,正如我们在AndroidAnnotations 中展示的那样wiki。
标签: android gradle android-annotations