2

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

方法没有签名:org.gradle.api.java.archives.internal.DefaultManifest.srcFile() 适用于参数类型:(java.lang.String) 值:[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'

  }
}
4

1 回答 1

3

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

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

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

于 2013-10-10T20:49:14.030 回答