没有方法签名:org.gradle.api.java.archives.internal.DefaultManifest.srcFile()

时间:2013-09-28 09:07:37

标签: java android-studio gradlew

在Android studio中,我只想为android项目定义一个自定义项目结构(按照这个,http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Project-Structure),但运行时:     ./gradlew任务 我收到错误:评估根项目'greendao-example'时出现问题。

  

没有方法签名:org.gradle.api.java.archives.internal.DefaultManifest.srcFile()适用于参数类型:(java.lang.String)values:[AndroidManifest.xml]

build.gradle是:

buildscript {
  repositories {
      mavenCentral()
}

   dependencies {
     classpath 'com.android.tools.build:gradle:0.5.+'
   }

}

apply plugin: 'android'
apply plugin: 'java'

  repositories {
mavenCentral()
}

dependencies {
compile 'com.android.support:support-v4:13.0.+'
}

android {
    testBuildType = "debug"

    defaultConfig {
    versionCode = 1
    versionName = "0.1"
    minSdkVersion = 9
    targetSdkVersion = 17


    compileSdkVersion = 17
    buildConfig "private final static boolean DEFAULT = true;", \
                "private final static String FOO = \"foo\";"
    }

    buildTypes {
    debug {
        packageNameSuffix = ".debug"

        buildConfig "private final static boolean DEBUG2 = false;"
    }
    }

    aaptOptions {
    noCompress "txt"
    }
    sourceSets {          
     manifest.srcFile  'AndroidManifest.xml'

  }
}

1 个答案:

答案 0 :(得分:3)

您需要将清单添加到主sourceSet。

sourceSets {
    main {          
        manifest.srcFile  'AndroidManifest.xml'
    }
}

请参阅Google的gradle示例中的已迁移示例: http://tools.android.com/tech-docs/new-build-system/gradle-samples-0.5.zip