Error: 'failed to create directory'


Probably this question might have been asked too many times already. But I am not able to find the solution for once. I am running a very simple code in Processing 3.5.2 on windows 7 in android mode. The code is as follows:

int i=0;

void setup()


void draw()
float i = random(400);


I get the same huge error as follows like many others have:

Build folder: C:\Users\ABHAY~1.IAM\AppData\Local\Temp\android6071948762103051950sketch
:app:preBuild UP-TO-DATE
:app:processDebugResourceserror: failed to create directory ‘C:\Users\Abhay.IAMPADIK\AppData\Local\Temp\android6071948762103051950sketch\app\build\generated\source\r\debug\processing\test\sketch_190130a’.

Failed to execute Failed to execute aapt
at sun.reflect.GeneratedMethodAccessor640.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.gradle.internal.reflect.JavaMethod.invoke(
at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(
at org.gradle.internal.concurrent.ManagedExecutorImpl$
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$
at org.gradle.internal.concurrent.ThreadFactoryImpl$

and it goes on and on. The aforementioned directory (which the error says didn’t open) exists only till ‘debug’ folder. Rest of the directories ‘processing\test\sketch_190130a’ doesn’t exist.

It would be a great help since I have been struggling on this for a month now… :frowning:

Are there any environment variable setting required here? If yes, what should they be?

Please ask whatever details/more information you need. Trying to avoid using Android studio for coding.


I would say it is permissions to write in the directory as I quote above. Can you run your code again and when it fails, go to the directory similarly to the one shown above and see if you have proper writing permission on that folder? (Does the folder actually exist?)

Check this as it might help: Building problem


1 Like


I tried rerunning the code as you said. As I said earlier, the folders exist (rather are created fresh during every run) only till ‘debug’. last three folders (processing\test\sketch_190130a) don’t exist really.

The permissions: All the folders have this blue filled box in front of their “read only” attributes. But if they were only readable, new directories wouldn’t have created after every run.


Could you create a ticket in GitHub with details and reproduction steps? Maybe Android Processing are aware of the issue. Previous reported issues related to your error code:✓&q=failed+to+create+directory

My thoughts are to dig into the source code and figure it out what call is being used to generate this temp folders. This is a call of some Java function. Then search this function online against your OS to see if it shows any leads.


1 Like

I am so sorry for a delayed reply.

I realized the problem in my case. For some reason I had to reinstall windows 7 in my machine. And guess what !! Everything worked just fine!!

If we speculate the issue with that result, it is very likely that there is some file missing that an antivirus or something must have deleted. According to my experience, what I would recommend people getting such error is to try a fresh install (keep this) in a newly installed windows 7 on another PC/lappy and see if it works… mostly it will work!
Another reason I am saying this is because in Linux, it worked within blink of an eye. Linux has less virus/antivirus problems and less likely such important files are deleted. (again, there could be other reasons too)

I hope this update helps people facing this issue “failed to create directory”. People are free to comment if my speculation seems wrong anywhere.

1 Like

Thxs for sharing!


1 Like