Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle file paths too long for Windows

Alright, I've seen similar questions but I have yet to find a satisfying solution to this, so I'm opening a new one. The problem is that Gradle produces insanely long file paths that blow past the 240 path limit on Windows. The problem is, once arm-linux-androideabi-ar runs I get errors like this:

arm-linux-androideabi-ar: C:/tmp/ATC/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/[redacted]/D_/[redacted]/android/[redacted]_ATC/src/main/jni/__/__/__/__/[redacted]/src/main/jni/__/__/__/__/__/source_code/app/missions/mission_utils/mission_data/mission_difficulty.o: No such file or directory
make: *** [C:/tmp/ATC/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/lib[redacted].a] Error 1

I have already changed the buildDir of the gradle project to C:/tmp and stripped as much of it as possible. I have also moved the project itself to the root of the drive, as well as enabled Windows 10 long paths, which are the only suggestions I have found. However, looking at the path, it really looks like Gradle turns .. int __ instead of turning it into a real path, so the path to the file could just as well be:

C:/tmp/ATC/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/[redacted]/D_/[redacted]/android/[redacted]_ATC/source_code/app/missions/mission_utils/mission_data/mission_difficulty.o

Still a string that strikes me as insanely long but it would solve my problem for the time being. Is it possible to convince Gradle to generate these kinds of paths? Is there anything else that I can do? Windows 10 long path support is already enabled

like image 907
JustSid Avatar asked Jul 07 '18 20:07

JustSid


People also ask

What do you do when a file path is too long?

If you see this error there are several solutions: 1) Instead of right clicking on the file to extract it, left click on the file to enter the zip directly. Then look for long folder names and make them shorter. Then close the zip file and extract it again.

How do I fix long path in Windows 10?

1] Press Win + R to open the Run window and type the command regedit. Press Enter to open the Registry Editor. 3] In the right-pane, double-click on (or right-click >> Modify) LongPathsEnabled. 4] Set the Value data to 1 and click on OK to save the settings.


1 Answers

The windows long path support is there (win10, even on Win7) but the tooling is not yet there.

Still a string that strikes me as insanely long but it would solve my problem for the time being. Is it possible to convince Gradle to generate these kinds of paths?

Not that I know of. I think the path itself is not an issue it is the prefix that matters, if you use long paths.

Is there anything else that I can do? Windows 10 long path support is already enabled.

I think Windows 10 long path support will not help in your case. The issue is that anything that you build with arm-linux-androideabi-ar has not been prefixed by \\?\ which is needed for windows to recognize that it is a long path.

There is even opened ticket #711 for your problem. The solution would be similar as for clang++.

The workarounds that came to me:

It is not a "pure" windows solution. One would be to use windows 10 linux subsystem. Second option would be to use MSYS2 and specific for Gradle.

like image 137
tukan Avatar answered Oct 18 '22 06:10

tukan