web-dev-qa-db-fra.com

Android Studio 3.1.1 Erreur CreateProcess = 206, le nom de fichier ou l'extension est trop long

Je reçois l'exception ci-dessous lors de la création de l'application à partir d'Android StudioIl dit 

CreateProcess error = 206, le nom de fichier ou l'extension est trop long 

J'avais essayé d'activer des chemins plus longs dans Windows regedit, mais je faisais toujours face au problème. S'il vous plaît aider!

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithDesugarForDebug'. com.Android.build.api.transform.TransformException: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'C:\jdk1.8.0_171\bin\Java.exe''

* Try:
Run with --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformClassesWithDesugarForDebug'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.Java:100)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.Java:70)
    at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.Java:51)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.Java:62)
    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.Java:54)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.Java:60)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.Java:97)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.Java:87)
    at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.Java:52)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.Java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.Java:54)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.Java:43)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.Java:34)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.Java:248)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.Java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.Java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.Java:199)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.Java:110)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.Java:241)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.Java:230)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.Java:123)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.Java:79)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.Java:104)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.Java:98)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.Java:626)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.Java:581)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.Java:98)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.Java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.Java:46)
    at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1149)
    at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:624)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.Java:55)
    at Java.lang.Thread.run(Thread.Java:748)
Caused by: Java.lang.RuntimeException: com.Android.build.api.transform.TransformException: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'C:\jdk1.8.0_171\bin\Java.exe''
    at com.Android.builder.profile.Recorder$Block.handleException(Recorder.Java:55)
    at com.Android.builder.profile.ThreadRecorder.record(ThreadRecorder.Java:104)
    at com.Android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.Java:212)
    at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:62)
    at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
    at Java.lang.reflect.Method.invoke(Method.Java:498)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.Java:73)
    at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.Java:46)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.Java:39)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.Java:26)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.Java:121)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.Java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.Java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.Java:199)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.Java:110)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.Java:110)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.Java:92)
    ... 32 more
Caused by: com.Android.build.api.transform.TransformException: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'C:\jdk1.8.0_171\bin\Java.exe''
    at com.Android.build.gradle.internal.transforms.DesugarTransform.transform(DesugarTransform.Java:292)
    at com.Android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.Java:221)
    at com.Android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.Java:217)
    at com.Android.builder.profile.ThreadRecorder.record(ThreadRecorder.Java:102)
    ... 48 more
Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'C:\jdk1.8.0_171\bin\Java.exe''
    at org.gradle.process.internal.DefaultExecHandle.execExceptionFor(DefaultExecHandle.Java:222)
    at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.Java:202)
    at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.Java:342)
    at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.Java:86)
    at org.gradle.internal.operations.BuildOperationIdentifierPreservingRunnable.run(BuildOperationIdentifierPreservingRunnable.Java:35)
    ... 6 more
Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'C:\jdk1.8.0_171\bin\Java.exe'
    at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.Java:27)
    at net.rubygrapefruit.platform.internal.WindowsProcessLauncher.start(WindowsProcessLauncher.Java:22)
    at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.Java:36)
    at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.Java:68)
    ... 7 more
Caused by: Java.io.IOException: Cannot run program "C:\jdk1.8.0_171\bin\Java.exe" (in directory "D:\CodeRepository\Android\iamhere-Android-app\app"): CreateProcess error=206, The filename or extension is too long
    at Java.lang.ProcessBuilder.start(ProcessBuilder.Java:1048)
    at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.Java:25)
    ... 10 more
Caused by: Java.io.IOException: CreateProcess error=206, The filename or extension is too long
    at Java.lang.ProcessImpl.create(Native Method)
    at Java.lang.ProcessImpl.<init>(ProcessImpl.Java:386)
    at Java.lang.ProcessImpl.start(ProcessImpl.Java:137)
    at Java.lang.ProcessBuilder.start(ProcessBuilder.Java:1029)
    ... 11 more


* Get more help at https://help.gradle.org

BUILD FAILED in 7m 38s 107 tâches pouvant être déclenchées: 11 exécutées, 96 à jour

8
user2067340

Je suppose que vous êtes l'utilisateur Windows, il existe une limite de chemin de fichier de 8191 dans Windows XP et les versions ultérieures.

http://support.Microsoft.com/kb/830473/en-us

La manière la plus simple de raccourcir le chemin du fichier, comme de changer le dossier du projet en D: \, de refacturer votre chemin et d’utiliser toujours les caractères ASCII pour le nom du dossier. Les caractères UTF-8 utilisent 2 à 3 octets ..__ ou déplacent des dépendances inutiles ..__ ou passent à la plate-forme MAC. ;)

La raison en est à la compilation, il y a une commande comme javac xxxx, qui combine le chemin de toutes les dépendances sur une seule ligne.

7
xingjiu

Si vous utilisez intellij idea, vous pouvez raccourcir la ligne de commande en procédant comme suit:

  1. aller à Exécuter/Debug Configuration
  2. choisissez fichier classpath dans raccourcir la ligne de commande zone de dépôt. Exemple ci-dessous.

 Shorten comman line example

0
Artem S.