错误:通过使用gradle创建签名的apk,输入目录“Files”不存在

时间:2015-03-20 09:36:13

标签: android android-gradle build.gradle android-productflavors

我有一个当前的android项目,它包含一个普通的Android应用程序和一个库,应用程序使用它。该应用程序具有不同的产品口味。当我尝试使用带有“gradle clean assemble {PRODUCT_FLAVOUR}”的gradle构建项目时,我收到以下错误:

BUILD FAILED

Total time: 16.078 secs
Failed to run command:
    C:\Developer\android-sdk\build-tools\22.0.0\aapt.exe package -f --no-crunch -I C:\Developer\android-sdk\platforms\android-22\android.jar -M [PROJECT_PATH]\radio\build\intermediates\manifests\full\[PRODUCT_FLAVOUR]\debug\AndroidManifest.xml -S [PROJECT_PATH]\radio\build\intermediates\res\[PRODUCT_FLAVOUR]\debug -A [PROJECT_PATH]\radio\build\intermediates\assets\[PRODUCT_FLAVOUR]\debug -m -J [PROJECT_PATH]\radio\build\generated\source\r\[PRODUCT_FLAVOUR]\debug -F [PROJECT_PATH]\radio\build\intermediates\res\resources-[PRODUCT_FLAVOUR]-debug.ap_ --debug-mode --custom-package  -0 apk --output-text-symbols [PROJECT_PATH]\radio\build\intermediates\symbols\[PRODUCT_FLAVOUR]\debug
Error Code:
    1
Output:
    ERROR: input directory 'apk' does not exist

以下是我的应用的构建文件的样子:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 22
        versionCode 1
        versionName "1.0.0"
    }

    signingConfigs {
        productflavour1_release {
            storeFile file("flavour1.keystore")
            storePassword "******"
            keyAlias "******"
            keyPassword "******"
        }
        productflavour2_release {
            storeFile file("flavour2.keystore")
            storePassword "******"
            keyAlias "******"
            keyPassword "******"
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    lintOptions {
        checkReleaseBuilds false
    }

    productFlavors {
        productflavour1 {
            applicationId "[ID]"
            versionCode 1
            signingConfig signingConfigs.productflavour1_release
        }

        productflavour2 {
            applicationId "[ID]"
            versionCode 1
            signingConfig signingConfigs.productflavour2_release
        }

        ...
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'commons-logging:commons-logging-api:1.1'
    compile project(':streamingservice')
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

这是我图书馆的那个:

    buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'
    }
}

apply plugin: 'com.android.library'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 22
    buildToolsVersion "22"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }


    buildTypes {
        release {
            minifyEnabled false
        }
    }
}

dependencies {
    compile 'commons-logging:commons-logging-api:1.1'
}

你有什么建议吗?

感谢您的帮助!

致以最诚挚的问候,

罗宾

1 个答案:

答案 0 :(得分:0)

package="com.yourpackage"

中的<manifest>代码中可能缺少AndroidManifest.xml个属性

有一个类似的问题,即gradle任务没有使用注入的应用程序ID