我正在將一個gradle構建過程中的oroirdannotations集成到一個通用的android項目中。當我嘗試建立與加apply plugin: 'androidannotations
我碰到下面的故障項目:由於androidannotations插件造成的Gradle構建失敗
$ 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搖籃plugin'已被棄用,不再更新。只要使用'android-apt',我們將在AndroidAnnotations [wiki](https://github.com/excilys/androidannotations/wiki/Building-Project-Gradle)中演示它。 – WonderCsabo 2015-01-24 12:18:52