我使用的是Android Studio 2.0 RC 1.今天安卓工作室给了自己一个错误。
错误:任务':app:packageDebug'的执行失败。 com.android.builder.packaging.PackagerException:java.io.IOException: 无法读取zip文件'D:\ Unimag \ MyUnimax21042016 \ app \ 建立\输出\ APK \ APP-debug.apk”。
我的gradle文件:
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'
}
来自Messages 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:\Unimag\MyUnimax21042016\app\build\outputs\apk\app-debug.apk'.
Information:BUILD FAILED
Information:Total time: 0.648 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
答案 0 :(得分:2)
我能够使用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'
对我来说,这解决了这个问题。
答案 1 :(得分:2)
切换GIT分支时发生了这种情况。它只需运行Build
- > Clean Project
。
MacOS 10.12 Sierra
答案 2 :(得分:0)
我尝试手动删除文件,但SO告知:文件" app-debug.apk"正在使用" OpenJDK Platform Binary"。然后我杀了" OpenJDK平台二进制"这很有用。
答案 3 :(得分:0)
删除平台并再次安装,就这样。