Error when compiling with gradle (can't find d

2019-02-11 05:06发布

问题:

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 huge 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 dowloaded and it's correctly located on that exactly direction.

It has a path lenght of 204 characters, so supposedly it's not surpassing the limit of 255 path characters on NTFS windows fyle 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?

Thanks

回答1:

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



回答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


回答3:

Path length cause failure.

I defined

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

in gradle run parameters and it solved the problem.