无法找到或加载主类org.gradle.wrapper.GradleWrapperMain [英] Could not find or load main class org.gradle.wrapper.GradleWrapperMain
问题描述
我删除本地目录,比如〜/ .gradle
,〜/ .m2目录
<$清理整个项目。C $ C>〜/ Android版和〜/工作区/项目/ .gradle
和艇员选拔文件 - &GT;无效Android Studio中缓存/重新启动...
。
现在命令执行 ./ gradlew
引出了下面的输出:
I cleaned the whole project by deleting local directories like ~/.gradle
, ~/.m2
~./android
and ~/workspace/project/.gradle
and chosing File -> Invalidate Caches / Restart...
in Android Studio.
Now execution of the command ./gradlew
leads to the following output:
usr$ ./gradlew tasks
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
不用说,我删除了太多,问题是怎么能重修?你有什么想法如何解决这一问题?
Needless to say, I deleted too much, the question is how can it be repaired again? Do you have any ideas how to fix this?
推荐答案
gradlew
是gradle这个包装可执行 - 上的其他地方的窗户和shell脚本批处理脚本。如果您在以下行的的build.gradle
,
gradlew
is the gradle wrapper executable - batch script on windows and shell script elsewhere. If you include the following lines in your build.gradle
,
task wrapper(type: Wrapper) {
gradleVersion = '2.0'
}
的Gradle一个包装脚本添加到您的源文件夹。调用时包装脚本,下载的gradle定义版本,并执行它。通过与项目分发的包装,任何人都可以使用它,而无需预先安装摇篮。更妙的是,构建的用户都保证用摇篮的版本构建设计的工作。
a gradle wrapper script is added to your source folders. The wrapper script when invoked, downloads the defined gradle version, and executes it. By distributing the wrapper with your project, anyone can work with it without needing to install Gradle beforehand. Even better, users of the build are guaranteed to use the version of Gradle that the build was designed to work with.
在你删除,你删除了gradlew取决于什么。您可以从您的源回购拉只是gradlew文件,或者如果你有安装的gradle运行包装的gradle
来恢复它。
In your deletions, you deleted something that gradlew depends upon. You can either pull just the gradlew files from your source repo, or if you have gradle installed run gradle wrapper
to restore it.
REF:摇篮包装
这篇关于无法找到或加载主类org.gradle.wrapper.GradleWrapperMain的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!