今天使用 Android Studio 构建项目的时候出现了这个错误 compileDebugJavaWithJavac
gradlew compileDebugJavaWithJavac
来进行原因查看 PS D:\gitlab\develop\ruixinAndroid_new> ./gradlew compileDebugJavaWithJavacUnzipping C:\Users\lijingbo\.gradle\wrapper\dists\gradle-4.5.1-all\4alu8ppoj4agqqum265te8rc7u\gradle-4.5.1-all.zip to C:\Users\lijingbo\.gradle\wrapper\dists\gradle-4.5.1-all\4alu8ppoj4agqqum265te8rc7uException in thread "main" java.lang.RuntimeException: java.util.zip.ZipException: error in opening zip file at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:78) at org.gradle.wrapper.Install.createDist(Install.java:47) at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129) at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)Caused by: java.util.zip.ZipException: error in opening zip file at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.(ZipFile.java:220) at java.util.zip.ZipFile. (ZipFile.java:150) at java.util.zip.ZipFile. (ZipFile.java:164) at org.gradle.wrapper.Install.unzip(Install.java:160) at org.gradle.wrapper.Install.access$400(Install.java:29) at org.gradle.wrapper.Install$1.call(Install.java:70) at org.gradle.wrapper.Install$1.call(Install.java:47) at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65) ... 3 more
通过以上 Log , 可以看到是因为 gradle-4.5.1 解压失败造成的,进入到该目录,发现 gradle-4.5.1 没有下载完成,只下载了 50MB ,官网是97MB 。重新从官网下载就可以了。
参考: