问题描述
我正在尝试使用libgdx在android studio上做一个项目,但是在生成libgdx项目时遇到了问题.起初,他告诉我我的局部变量JAVA_HOME有问题,他找不到我的JDK(存在)当我尝试将Java JDK复制到文件"c:\ dev \ java \ JDK"时,他告诉我:
I'm trying to do a project on android studio with libgdx but I have a problem when I generate a libgdx project.At first, he told me that my local variable JAVA_HOME had a problem and he could findn't my JDK (that was present)When I tried to copy my java JDK on my file "c:\dev\java\JDK", he told me :
Generating app in C:\Users\Thomas\Desktop\YoloRPG
Executing 'C:\Users\Thomas\Desktop\YoloRPG/gradlew.bat clean --no-daemon'
Unzipping C:\Users\Thomas\.gradle\wrapper\dists\gradle-2.10-
all\5b6kqrscumh9p4evkkemdk57ad\gradle-2.10-all.zip to
C:\Users\Thomas\.gradle\wrapper\dists\gradle-2.10-all\5b6kqrscumh9p4evkkemdk57ad
Exception 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:61)
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:219)
at java.util.zip.ZipFile.<init>(ZipFile.java:149)
at java.util.zip.ZipFile.<init>(ZipFile.java:163)
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
Done!
To import in Eclipse: File -> Import -> Gradle -> Gradle Project
To import to Intellij IDEA: File -> Open -> build.gradle
当我尝试使用以下命令在android上打开创建的项目时文件->导入设置...消息框弹出并显示找不到文件'C:\ Users \ Thomas \ Desktop \ YoloRPG \ settings.jar'"
And when I try to open the created project on android withfiles --> import settings...A message box popup with written"Cannot find file 'C:\Users\Thomas\Desktop\YoloRPG\settings.jar'"
有人可以帮助我吗? :(
Can someone please help me ? :(
推荐答案
原因:java.util.zip.ZipException:打开zip文件时出错
Caused by: java.util.zip.ZipException: error in opening zip file
这意味着Gradle下载的文件由于某种原因被损坏.这可能是Gradle本身的下载(包装程序所做的),也可能是Gradle为运行libgdx构建而下载的任何依赖项.
This mean that a file that Gradle has downloaded has become corrupted due to somehow or some reason.This might be the download of Gradle itself (which the wrapper does), or any dependency that Gradle has downloaded to run your libgdx build.
Gradle不会尝试检测或解决问题,因此您需要手动修复它.解决方案通常是清除Gradle的下载缓存,并让它获取所需内容的新副本.
Gradle doesn't attempt to detect or resolve the problem, so you need to fix it manually. The solution is often to purge Gradle's download caches and let it get fresh copies of what it needs.
为此,请同时删除主目录和项目根目录中的.gradle目录,然后尝试重新构建.
To do that, delete the .gradle directories in both your home directory and in your project's root directory and try building again.
您的主目录是
C:\Users\Thomas\.gradle
和项目的根目录
C:\Users\Thomas\Desktop\YoloRPG
这篇关于当我尝试生成libgdx projet时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!