android - Gradle 找不到 list 文件

标签 android gradle android-annotations

我正在尝试构建一个项目,但当我尝试从命令行构建它时出现以下错误:

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位于项目结构中的主要部分。 这是我的 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"
 }
}

有人知道问题出在哪里吗? 预先非常感谢您!

最佳答案

添加此:

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

关于android - Gradle 找不到 list 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34184814/

相关文章:

android - 如何在 Kotlin 中使用 AndroidAnnotation @SharedPref

java - android - 在调试时关闭乱舞

android - Android中的USB type-c耳机检测

android - 当 primaryDark 为白色时更改状态栏文本颜色

java - Android Studio:从Github导入Project并重新构建/清理/与Gradle文件同步后的 “cannot resolve symbol R”

bintray 日落后 Android 项目构建失败

java - 为什么客户端套接字可以检测到服务器套接字关闭,但反之则不行?

android - 如何从付费应用程序构建中排除广告库?

Android 在 Library Project Eclipse 中使用 AndroidAnnotations

AndroidAnnotations 没有生成,空 Activity