使用 Gradle 编译时出错(找不到下载的依赖项)

Error when compiling with Gradle (can#39;t find downloaded dependencies)(使用 Gradle 编译时出错(找不到下载的依赖项))
本文介绍了使用 Gradle 编译时出错(找不到下载的依赖项)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我开发了一个应用生成系统,它通过命令行 Gradle 编译命令重新生成应用.

I develop an app generation system that is regenerating apps by command line Gradle compilation commands.

在我的 Windows Server 2008 中,我在更新到最新的 Gradle 版本和 Gradle 插件版本后遇到了问题.

In my Windows Server 2008, I'm facing a problem after updating to the last Gradle version and Gradle plugin version.

编译时出现以下错误:

C:WindowsSystem32configsystemprofile.gradlecaches	ransforms-1files-1.1appcompat-v7-25.0.0.aare93435c34d5cae8b6677dcef529711a5
esdrawable-xxhdpi-v4abc_text_select_handle_middle_mtrl_light.png: error: file not found.

C:WindowsSystem32configsystemprofile.gradlecaches	ransforms-1files-1.1appcompat-v7-25.0.0.aare93435c34d5cae8b6677dcef529711a5
esdrawableabc_btn_colored_material.xml: error: file not found.

C:WindowsSystem32configsystemprofile.gradlecaches	ransforms-1files-1.1appcompat-v7-25.0.0.aare93435c34d5cae8b6677dcef529711a5
esdrawable-hdpi-v4abc_textfield_search_default_mtrl_alpha.9.png: error: file not found.

and a lot more of errors like those...

我不确定为什么会收到此错误,因为文件已正确下载并且正确位于该方向.

I'm not sure why I'm getting this error, because the file is correctly downloaded and it's correctly located on that exactly direction.

它的路径长度为 204 个字符,因此应该不会超过 NTFS Windows 文件系统上 255 个路径字符的限制.

It has a path length of 204 characters, so supposedly it's not surpassing the limit of 255 path characters on NTFS Windows file system.

是否可以更改 Gradle 下载其缓存依赖项的位置?这个问题是由这个还是由其他原因引起的?

It is possible to change the location where Gradle downloads it's cached dependencies? Is this problem caused by this or by other thing?

推荐答案

终于解决了这个问题,将windows中的环境变量GRADLE_USER_HOME设置为c:/gradle-cache

finally i solved this setting the environmental variable GRADLE_USER_HOME in windows to c:/gradle-cache

所以肯定与文件路径长度有关

so definitively it's related to file path lenght

这篇关于使用 Gradle 编译时出错(找不到下载的依赖项)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Android release APK crash with java.lang.AssertionError: impossible in java.lang.Enum(Android 发布 APK 因 java.lang.AssertionError 崩溃:在 java.lang.Enum 中不可能)
Finished with Non Zero Exit Value 3(以非零退出值 3 结束)
On gradle:3.0.0 More than one file was found with OS independent path #39;META-INF/ASL2.0#39;(在 gradle:3.0.0 上找到多个文件,其独立于操作系统的路径为“META-INF/ASL2.0)
Android : app loading library at runtime on Lollipop but not IceCreamSandwich(Android:运行时在 Lollipop 上而不是 IceCreamSandwich 上的应用程序加载库)
buildConfigField depending on flavor + buildType(buildConfigField 取决于风味 + buildType)
How do I suppress warnings when compiling an android library with gradle?(使用 gradle 编译 android 库时如何抑制警告?)