我正在尝试在android中setUp我的第一个gradle项目:我得到了以下错误,这对我来说毫无意义,因为'app/src/main/AndroidManifest.xml‘是一个字符串。
错误:(23,0)方法没有签名: org.gradle.api.java.archives.internal.DefaultManifest.srcFile()适用于参数类型:(java.lang.String)值: app/src/main/AndroidManifest.xml
gradle构建脚本如下所示:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.2'
classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.9.4'
classpath "org.mockito:mockito-core:1.9.5"
}
}
apply plugin: 'android'
allprojects {
repositories {
mavenCentral()
}
}
sourceSets {
main {
manifest.srcFile("app/src/main/AndroidManifest.xml")
}
unitTest {
java.srcDir file('src/test/java')
resources.srcDir file('src/test/res')
}
}
configurations {
unitTestCompile.extendsFrom runtime
unitTestRuntime.extendsFrom unitTestCompile
}
dependencies {
repositories {
mavenCentral()
}
unitTestCompile files("$project.buildDir/classes/release")
unitTestCompile 'junit:junit:4.10'
unitTestCompile 'org.robolectric:robolectric:2.1.+'
unitTestCompile 'com.google.android:android:4.0.1.2'
}
task unitTest(type:Test, dependsOn: assemble) {
testClassesDir = project.sourceSets.unitTest.output.classesDir
classpath = project.sourceSets.unitTest.runtimeClasspath
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
}
check.dependsOn unitTest谢谢你的帮助。
托尔斯顿
发布于 2014-05-09 16:48:47
错误消息意味着在sourceSets.main.manifest上没有名为sourceSets.main.manifest的方法,或者它不接受字符串作为参数。(通常是前者。)我认为您在这里试图配置的是android { sourceSets { ... } },而不是sourceSets { ... }。
https://stackoverflow.com/questions/23569005
复制相似问题