错误:任务执行失败':app:zipalignDebug'当资产中的大文件夹

时间:2016-05-29 09:53:26

标签: android android-gradle

我在使用资源中的大文件夹构建应用时遇到问题。我的文件夹大小等于179 MB,磁盘大小为463mb,因为它包含大量的小文件。当我删除一个子文件夹,其大小是整个内容的90%时,一切都成功构建。当我拉链整个文件夹时,一切都运行良好。问题是当我在资产中解压缩整个内容时。

这是app的build.gradle脚本:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "XXX"
        minSdkVersion 19
        targetSdkVersion 23
        versionCode 5
        versionName "1.4"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            zipAlignEnabled true
        }
    }
}

和记录

Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72310Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42310Library UP-TO-DATE
:app:prepareComGithubNirhartParallaxscroll10Library UP-TO-DATE
:app:prepareIleo_branchingBLB_SDKUnspecifiedLibrary UP-TO-DATE
:app:prepareIleo_branchingOsmbonuspack_v561UnspecifiedLibrary UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources
:app:generateDebugSources
:app:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:prePackageMarkerForDebug
:app:transformClassesWithDexForDebug UP-TO-DATE
:app:mergeDebugJniLibFolders UP-TO-DATE
:app:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:app:validateDebugSigning
:app:packageDebug
:app:zipalignDebug
Unable to open 'C:\Users\directory to app\app\build\outputs\apk\app-debug-unaligned.apk' as zip archive
Error:Execution failed for task ':app:zipalignDebug'.
> Process 'command 'C:\Users\xxx\Android\build-tools\23.0.2\zipalign.exe'' finished with non-zero exit value 1
Information:BUILD FAILED
Information:Total time: 5 mins 21.971 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

我使用的是android studio 2.1.1,gradle tools 2.1.0版本。

您是否知道如何解决此问题?

1 个答案:

答案 0 :(得分:1)

只需构建>清洁项目解决了我的问题。