错误:任务":应用:包调试"执行失败。> com.android.builder.packaging.PackagerException



我使用 Android Studio 2.0 RC 1。今天,安卓工作室给自己犯了一个错误。

错误:任务":应用:包调试"执行失败。 com.android.builder.packaging.PackagerException: java.io.IOException: 无法读取 zip 文件 'D:\Unimag\MyUnimax21042016\app\ build\outputs\apk\app-debug.apk'.

我的成绩文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"
    defaultConfig {
        applicationId "kz.dreamwings.unimax"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 2
        versionName "0.0.2"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            debuggable true
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:design:23.0.1'
    compile 'com.mcxiaoke.volley:library:1.0.19'
    compile 'com.android.support:cardview-v7:23.1.1'
    compile 'com.android.support:recyclerview-v7:23.2.1'
    compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.2.2'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.github.rahatarmanahmed:circularprogressview:2.5.0'
}

以及来自消息 Gradle Build 的完整消息

Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportCardviewV72311Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2301Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72321Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42321Library UP-TO-DATE
:app:prepareComGithubRahatarmanahmedCircularprogressview250Library UP-TO-DATE
:app:prepareComJoanzapataIconifyAndroidIconify222Library UP-TO-DATE
:app:prepareComJoanzapataIconifyAndroidIconifyFontawesome222Library 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 UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
: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 FAILED
Error:Execution failed for task ':app:packageDebug'.
> com.android.builder.packaging.PackagerException: java.io.IOException: Failed to read zip file 'D:UnimagMyUnimax21042016appbuildoutputsapkapp-debug.apk'.
Information:BUILD FAILED
Information:Total time: 0.648 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

我能够使用 Android Studio 的活动模板之一在一个干净的项目中重现该问题。对我来说,问题是 gradle 插件的预览版本。您使用的是 Android Studio 2.2 Preview 1 吗?如果是,请在build.gradle中找到此行:

classpath 'com.android.tools.build:gradle:+

并将其更改为:

classpath 'com.android.tools.build:gradle:2.1.0'

对我来说,这解决了问题。

切换 GIT 分支时,我遇到了这种情况。它只是运行Build -> Clean Project .

MacOS 10.12 Sierra

我尝试手动删除文件,但SO通知:"app-debug.apk"文件被"OpenJDK平台二进制文件"使用。然后我杀死了"OpenJDK平台二进制文件",这奏效了。

删除平台并再次安装它,就这个。

相关内容

  • 没有找到相关文章

最新更新