JustSid
JustSid

Reputation: 25318

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

Upvotes: 9

Views: 3108

Answers (1)

tukan
tukan

Reputation: 17345

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.

Upvotes: 3

Related Questions