2015-12-09 4 views
2

Я пытаюсь построить проект, но у меня есть следующее сообщение об ошибке, когда я пытаюсь построить его из командной строки:Gradle не может найти файл манифеста

error: Could not find the AndroidManifest.xml file, going up from path [C:\Users\User\Documents\work 
space\app\app\app\build\generated\source\apt\debug] found using dummy file [] 
(max atempts: file:///C:/Users/User/Documents/workspace/app/app/app/build/generated/source/apt/debug/dummy1449680140847.java) 

Мой manifest.xml находится под главным foulder в структуры проекта. и это мой Gradle файл:

import com.android.builder.core.DefaultManifestParser 

buildscript { 
repositories { 
    mavenCentral() 
} 

dependencies { 
    classpath 'com.android.tools.build:gradle:1.2.3' 
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' 
} 
} 



apply plugin: 'com.android.application' 
apply plugin: 'android-apt' 

android { 
compileSdkVersion 22 
buildToolsVersion "21.1.2" 

defaultConfig { 
    applicationId "com.ponideapps.recetapp" 
    minSdkVersion 14 
    targetSdkVersion 22 
    versionCode 1 
    versionName "1.0" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 

// This is important, it will run lint checks but won't abort build 
lintOptions { 
    abortOnError false 
} 

task srcZip(type: Zip) { 
    from projectDir 
    def manifestParser = new DefaultManifestParser() 
    def versionName = manifestParser.getVersionName(android.sourceSets.main.manifest.srcFile) 
    archiveName = "${project.name}-${versionName}.${extension}" 
    exclude 'build', 'gen', 'bin', '.DS_Store', '.settings', 'local.properties', '.gradle', '*.apk', '.idea', '*.iml', '*.log', 
      '*/build', "*/gen", "*/bin", '*/*.iml', '*/*.log' 
} 
assemble.dependsOn srcZip 
} 

allprojects { 
    repositories { 
    mavenCentral() 
} 
} 

android.applicationVariants.all { variant -> 
    println "Defining task generate${variant.name.capitalize()}Javadoc" 
    task("generate${variant.name.capitalize()}Javadoc", type: Javadoc) { 
    description "Generates Javadoc for $variant.name." 
    source = variant.javaCompile.source 

    //source = files() 
    //variant.sourceSets.each{ sourceSet -> 
    // sourceSet.javaDirectories.each{ javaDirectory -> 
    //  //println("adding source dir for javadoc generation: " + javaDirectory) 
    //  source += files(javaDirectory) 
    // } 
    //} 
    //source += files("$buildDir/generated/source/r/" + variant.dirName) 

    ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar" 
    classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar) 

    //why doesn't this help? This should add the classfiles for the apt & R files 
    //+ files("$buildDir/intermediates/classes/" + variant.dirName) 

    //this would allow markdown comments, however, the plugin seems to be broken and always claims it cannot write a file it has just written :(
    //options.doclet = 'com.visural.doclets.markdown.standard.Standard' 
    //options.docletpath = ["./libs/MarkdownDoclet-3.0.jar"] 

    options.links("http://docs.oracle.com/javase/7/docs/api/", "http://www.joda.org/joda-time/apidocs/"); 
    //this is necessary to create links to the android documentation: the android website does not 
    //contain the list necessary to create javadoc, the local installation does 
    options.linksOffline("http://d.android.com/reference", "${android.sdkDirectory}/docs/reference"); 

    exclude '**/BuildConfig.java' 
    exclude '**/R.java' 

    options.memberLevel = JavadocMemberLevel.PROTECTED 

    //this is very much necessary, as the apt files & the R.class would otherwise break the javadoc 
    failOnError false 
    } 
} 


dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
testCompile 'junit:junit:4.12' 
compile 'com.android.support:appcompat-v7:22.2.1' 
compile 'com.android.support:design:22.2.1' 
//android annotations 
compile files('libs/androidannotations-api-3.0.1.jar') 
apt files('libs_annotations/androidannotations-3.0.1.jar') 
    } 



apt { 
    arguments { 
    resourcePackageName "com.ponideapps.recetapp" 
} 
} 

ли кто-то, где проблема? Большое вам спасибо!

ответ

4

Добавить это:

apt { 
    arguments { 
    resourcePackageName "com.ponideapps.recetapp" 
    androidManifestFile variant.outputs[0]?.processResources?.manifestFile 
} 
} 
+0

Пожалуйста, отметьте ответ, как "принято". – Mangesh