Long path issue with Gradle on XP

Gradle throws exception due to long path on Windows XP

AILURE: Build aborted because of an internal error.

What went wrong: uild aborted because of an unexpected internal error. Please file an issue at: ttp://forums.gradle.org.

Try: un with --debug option to get additional debug info.

Exception is: rg.gradle.api.UncheckedIOException: Could not normalize path for file ‘C:\gradl \caches\artifacts-15\filestore\org.antlr\antlr\3.2\jar\6b0acabea7bb3da058200a77 78057e47e25cb69\antlr-3.2.jar;C:\gradle\caches\artifacts-15\filestore\antlr\ant r\2.7.7\jar\83cd2cd674a217ade95a4bb83a8a14f351f48bd0\antlr-2.7.7.jar;C:\gradle\ aches\artifacts-15\filestore\org.antlr\stringtemplate\3.2\jar\6fe2e3bb57daebd15 5494818909f9664376dd6c\stringtemplate-3.2.jar;C:\gradle\caches\artifacts-15\fil store\org.antlr\antlr-runtime\3.2\jar\31c746001016c6226bd7356c9f87a6a084ce3715\ ntlr-runtime-3.2.jar’.

at org.gradle.api.internal.file.AbstractFileResolver.normalise(AbstractF leResolver.java:118)

at org.gradle.api.internal.file.AbstractFileResolver.resolve(AbstractFil Resolver.java:59)

at org.gradle.api.internal.file.AbstractFileResolver.resolve(AbstractFil Resolver.java:53)

at org.gradle.api.internal.file.collections.DefaultFileCollectionResolve ontext$FileCollectionConverter.convertInto(DefaultFileCollectionResolveContext. ava:173)

at org.gradle.api.internal.file.collections.DefaultFileCollectionResolve ontext.doResolve(DefaultFileCollectionResolveContext.java:134)

at org.gradle.api.internal.file.collections.DefaultFileCollectionResolve ontext.resolveAsFileCollections(DefaultFileCollectionResolveContext.java:82)

Hi,

This is not enough information for us to make any use of.

What is your build trying to do at the time that this occurs?

you can repro this easily by building this source http://code.google.com/p/android-apktool/wiki/BuildApktool

The same problem, just:

git clone git://github.com/iBotPeaches/Apktool.git cd Apktool gradlew.bat build

and you’ll see the internal exception. The full error text is here:

https://code.google.com/p/android-apktool/issues/detail?id=393

There’s not much we can do about this. We could improve the error message though.

In the meantime, you can work around this by shortening the file paths by moving the Gradle user home directory. The simplest way to do this is to set the environment variable ‘GRADLE_USER_HOME’.

e.g.

set GRADLE_USER_HOME=c:\mygradlehome

Sorry, it doesn’t work. The result path is still very long.

Please run with ‘-s’ and post the exception trace.

Microsoft Windows XP [Version 5.1.2600] © Copyright 1985-2001 Microsoft Corp.

E:\4\android-apktool>e:\2\wrapper\dists\gradle-1.3-bin\4ff00h4teq8qe6qu3nnq4s8gin\gradle-1.3\bin\gradle.bat -s Building SNAPSHOT: 9281cba4a4 :help

Welcome to Gradle 1.3.

To run a build, run gradle …

To see a list of available tasks, run gradle tasks

To see a list of command-line options, run gradle --help

BUILD SUCCESSFUL

Total time: 3.218 secs E:\4\android-apktool>e:\2\wrapper\dists\gradle-1.3-bin\4ff00h4teq8qe6qu3nnq4s8gin\gradle-1.3\bin\gradle.bat -s build Building SNAPSHOT: 9281cba4a4 :compileJava UP-TO-DATE :processResources UP-TO-DATE :classes UP-TO-DATE :jar UP-TO-DATE :assemble UP-TO-DATE :licenseMain UP-TO-DATE :licenseTest UP-TO-DATE :compileTestJava UP-TO-DATE :processTestResources UP-TO-DATE :testClasses UP-TO-DATE :test UP-TO-DATE :check UP-TO-DATE :build UP-TO-DATE :brut.apktool:compileJava UP-TO-DATE :brut.apktool:processResources UP-TO-DATE :brut.apktool:classes UP-TO-DATE :brut.apktool:jar UP-TO-DATE :brut.apktool:assemble UP-TO-DATE :brut.apktool:compileTestJava UP-TO-DATE :brut.apktool:processTestResources UP-TO-DATE :brut.apktool:testClasses UP-TO-DATE :brut.apktool:test UP-TO-DATE :brut.apktool:check UP-TO-DATE :brut.apktool:build UP-TO-DATE :brut.apktool.smali:compileJava UP-TO-DATE :brut.apktool.smali:processResources UP-TO-DATE :brut.apktool.smali:classes UP-TO-DATE :brut.apktool.smali:jar UP-TO-DATE :brut.apktool.smali:assemble UP-TO-DATE :brut.apktool.smali:compileTestJava UP-TO-DATE :brut.apktool.smali:processTestResources UP-TO-DATE :brut.apktool.smali:testClasses UP-TO-DATE :brut.apktool.smali:test UP-TO-DATE :brut.apktool.smali:check UP-TO-DATE :brut.apktool.smali:build UP-TO-DATE :brut.j.common:compileJava UP-TO-DATE :brut.j.common:processResources UP-TO-DATE :brut.j.common:classes UP-TO-DATE :brut.j.common:jar UP-TO-DATE :brut.j.common:assemble UP-TO-DATE :brut.j.common:compileTestJava UP-TO-DATE :brut.j.common:processTestResources UP-TO-DATE :brut.j.common:testClasses UP-TO-DATE :brut.j.common:test UP-TO-DATE :brut.j.common:check UP-TO-DATE :brut.j.common:build UP-TO-DATE :brut.j.util:compileJava UP-TO-DATE :brut.j.util:processResources UP-TO-DATE :brut.j.util:classes UP-TO-DATE :brut.j.util:jar UP-TO-DATE :brut.j.dir:compileJava UP-TO-DATE :brut.j.dir:processResources UP-TO-DATE :brut.j.dir:classes UP-TO-DATE :brut.j.dir:jar UP-TO-DATE :brut.j.dir:assemble UP-TO-DATE :brut.j.dir:compileTestJava UP-TO-DATE :brut.j.dir:processTestResources UP-TO-DATE :brut.j.dir:testClasses UP-TO-DATE :brut.j.dir:test UP-TO-DATE :brut.j.dir:check UP-TO-DATE :brut.j.dir:build UP-TO-DATE :brut.j.util:assemble UP-TO-DATE :brut.j.util:compileTestJava UP-TO-DATE :brut.j.util:processTestResources UP-TO-DATE :brut.j.util:testClasses UP-TO-DATE :brut.j.util:test UP-TO-DATE :brut.j.util:check UP-TO-DATE :brut.j.util:build UP-TO-DATE :brut.apktool.smali:dexlib:compileJava UP-TO-DATE :brut.apktool.smali:dexlib:processResources UP-TO-DATE :brut.apktool.smali:dexlib:classes UP-TO-DATE :brut.apktool.smali:dexlib:jar UP-TO-DATE :brut.apktool.smali:util:compileJava UP-TO-DATE :brut.apktool.smali:util:processResources UP-TO-DATE :brut.apktool.smali:util:classes UP-TO-DATE :brut.apktool.smali:util:jar UP-TO-DATE :brut.apktool.smali:baksmali:compileJava UP-TO-DATE :brut.apktool.smali:baksmali:processResources UP-TO-DATE :brut.apktool.smali:baksmali:classes UP-TO-DATE :brut.apktool.smali:baksmali:jar UP-TO-DATE :brut.apktool.smali:baksmali:assemble UP-TO-DATE :brut.apktool.smali:baksmali:compileTestJava UP-TO-DATE :brut.apktool.smali:baksmali:processTestResources UP-TO-DATE :brut.apktool.smali:baksmali:testClasses UP-TO-DATE :brut.apktool.smali:baksmali:test UP-TO-DATE :brut.apktool.smali:baksmali:check UP-TO-DATE :brut.apktool.smali:baksmali:build UP-TO-DATE :brut.apktool.smali:dexlib:assemble UP-TO-DATE :brut.apktool.smali:dexlib:compileTestJava UP-TO-DATE :brut.apktool.smali:dexlib:processTestResources UP-TO-DATE :brut.apktool.smali:dexlib:testClasses UP-TO-DATE :brut.apktool.smali:dexlib:test UP-TO-DATE :brut.apktool.smali:dexlib:check UP-TO-DATE :brut.apktool.smali:dexlib:build UP-TO-DATE :brut.apktool.smali:smali:generateAntlrSource

FAILURE: Build aborted because of an internal error.

  • What went wrong: Build aborted because of an unexpected internal error. Please file an issue at: http://forums.gradle.org.

  • Try: Run with --debug option to get additional debug info.

  • Exception is: org.gradle.api.UncheckedIOException: Could not normalize path for file ‘E:\2\caches\artifacts-15\filestore\org.antlr\antlr\3.2\jar\6b0acabea7bb3da058200a77178057e47e25cb69\antlr-3.2.jar;E:\2\caches\artifacts-15\filestore \antlr\antlr\2.7.7\jar\83cd2cd674a217ade95a4bb83a8a14f351f48bd0\antlr-2.7.7.jar;E:\2\caches\artifacts-15\filestore\org.antlr\stringtemplate\3.2\jar\6fe2e3bb57daebd1555494818909f9664376dd6c\stringtemplate-3.2.jar;E:\2\cac hes\artifacts-15\filestore\org.antlr\antlr-runtime\3.2\jar\31c746001016c6226bd7356c9f87a6a084ce3715\antlr-runtime-3.2.jar’.

at org.gradle.api.internal.file.AbstractFileResolver.normalise(AbstractFileResolver.java:118)

at org.gradle.api.internal.file.AbstractFileResolver.resolve(AbstractFileResolver.java:59)

at org.gradle.api.internal.file.AbstractFileResolver.resolve(AbstractFileResolver.java:53)

at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext$FileCollectionConverter.convertInto(DefaultFileCollectionResolveContext.java:173)

at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:134)

at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileCollections(DefaultFileCollectionResolveContext.java:82)

at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext$FileCollectionConverter.convertInto(DefaultFileCollectionResolveContext.java:157)

at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:98)

at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileCollections(DefaultFileCollectionResolveContext.java:82)

at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext$FileCollectionConverter.convertInto(DefaultFileCollectionResolveContext.java:157)

at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:98)

at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileCollections(DefaultFileCollectionResolveContext.java:82)

at org.gradle.api.internal.changedetection.DefaultFileCacheListener.cacheable(DefaultFileCacheListener.java:29)

at org.gradle.api.internal.changedetection.FileCacheBroadcastTaskArtifactStateRepository$1.isUpToDate(FileCacheBroadcastTaskArtifactStateRepository.java:34)

at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:44)

at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)

at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)

at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)

at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)

at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)

at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:247)

at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.executeTask(DefaultTaskPlanExecutor.java:52)

at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.processTask(DefaultTaskPlanExecutor.java:38)

at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:30)

at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83)

at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)

at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)

at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)

at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java:31)

at org.gradle.internal.Factories$1.create(Factories.java:22)

at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:124)

at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:112)

at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:130)

at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79)

at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter.execute(TaskCacheLockHandlingBuildExecuter.java:29)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)

at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)

at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)

at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)

at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:158)

at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)

at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)

at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:38)

at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:39)

at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:25)

at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)

at org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions.java:137)

at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)

at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)

at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)

at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)

at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)

at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)

at org.gradle.launcher.Main.doAction(Main.java:48)

at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)

at org.gradle.launcher.Main.main(Main.java:39)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)

at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)

at org.gradle.launcher.GradleMain.main(GradleMain.java:26) Caused by: java.io.IOException: Die Syntax fur den Dateinamen, Verzeichnisnamen oder die Datentragerbezeichnung ist falsch

at java.io.WinNTFileSystem.canonicalize0(Native Method)

at java.io.Win32FileSystem.canonicalize(Win32FileSystem.java:396)

at java.io.File.getCanonicalPath(File.java:559)

at java.io.File.getCanonicalFile(File.java:583)

at org.gradle.api.internal.file.AbstractFileResolver.normalise(AbstractFileResolver.java:74)

… 65 more

BUILD FAILED

Total time: 4.11 secs

E:\4\android-apktool>

I just noticed the path it is trying to normalise is actually a semicolon separated list of paths:

C:\gradle\caches\artifacts-15\filestore\org.antlr\antlr\3.2\jar\6b0acabea7bb3da058200a7778057e47e25cb69\antlr-3.2.jar;C:\gradle\caches\artifacts-15\filestore\antlr\antr\2.7.7\jar\83cd2cd674a217ade95a4bb83a8a14f351f48bd0\antlr-2.7.7.jar;C:\gradle\aches\artifacts-15\filestore\org.antlr\stringtemplate\3.2\jar\6fe2e3bb57daebd155494818909f9664376dd6c\stringtemplate-3.2.jar;C:\gradle\caches\artifacts-15\filestore\org.antlr\antlrruntime\3.2\jar\31c746001016c6226bd7356c9f87a6a084ce3715\antlr-runtime-3.2.jar

This suggests that the plugin you are using is not designed to work on Windows I think.

It seems the error occurs inside the gradle code that checks cached libraries (jars), so it’s internal gradle structure to store filenames. Am I right?

Not necessarily. The fact that the files are sourced from the Gradle cache is not important. The issues appears to be that a compound file path is being passed to a method that assumes a single file.

‘org.gradle.api.internal.file.AbstractFileResolver.resolve(Object)’

So it’s a matter of working out why this method is being called with these parameters. It’s a bit suspicious since it appears to be failing during the uptodate check. Can you try running with ‘–rerun-tasks’?

The same exception. So, the same script works under Windows 8, Ubuntu 12.10 but doesn’t work under Windows XP and Windows 7. Interesting thing that it works on the friend’s XP.

One more time how to reproduce the problem under Windows XP:

git clone git://github.com/iBotPeaches/Apktool.git cd Apktool gradlew build

Ok, something happens (I’ve reinstalled jdk) and the building process works on my Windows XP. Going to test on Windows 7 at home.

Update.

Tested on Windows 7 x64:

  1. Installed jdk1.7.0_04 - exception as described above, ever with Gradle 1.4-rc-1.

  2. Installed jdk1.7.0_11 - all works just fine.

Hello use long path tool to solve your problem