Error when compiling with Gradle (can't find downloaded dependencies)
Asked Answered
A

4

7

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

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

When compiling I'm getting this errors:

C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.0.0.aar\e93435c34d5cae8b6677dcef529711a5\res\drawable-xxhdpi-v4\abc_text_select_handle_middle_mtrl_light.png: error: file not found.

C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.0.0.aar\e93435c34d5cae8b6677dcef529711a5\res\drawable\abc_btn_colored_material.xml: error: file not found.

C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.0.0.aar\e93435c34d5cae8b6677dcef529711a5\res\drawable-hdpi-v4\abc_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.

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.

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

Astute answered 24/11, 2017 at 10:55 Comment(0)
A
16

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

Astute answered 24/11, 2017 at 11:51 Comment(1)
That saved my day!! Literally the whole day trying to figure out why this was happening. The error would only happen for me building from Jenkins. Running the same cli command from cmd in Windows at same path would build with no errors though.Fitch
C
2

I meet this same error in windows jenkins

I solved this error.

gradle assembleDebug -g C:\gradle-cache

-g:

gradle -h

-g, --gradle-user-home    Specifies the gradle user home directory
Compartmentalize answered 18/12, 2017 at 8:34 Comment(0)
G
0

Path length cause failure.

I defined

"-Dorg.gradle.user.home=%GRADLE_USER_HOME%"

in gradle run parameters and it solved the problem.

Garamond answered 26/7, 2018 at 10:57 Comment(0)
B
0

2023 Update:

If you want to do this through Android Studio go to

Settings -> Build, Execution, Deployment -> Build Tools -> Gradle -> Gradle user home [textbox]

Betulaceous answered 13/7, 2023 at 8:23 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.