java.lang.IllegalArgumentException: Parameter 'directory' is not a directory in android
Asked Answered
U

1

26

I rebuilt my project and got this error. I'm unable to find where it's coming from. The full log is:

Caused by: java.lang.IllegalArgumentException: Parameter 'directory' is not a directory
    at org.apache.commons.io.FileUtils.validateListFilesParameters(FileUtils.java:545)
    at org.apache.commons.io.FileUtils.listFiles(FileUtils.java:521)
    at android.databinding.tool.store.ResourceBundle.loadClassInfoFromFolder(ResourceBundle.java:157)
    at android.databinding.tool.store.LayoutInfoInput$deps$2.invoke(LayoutInfoInput.kt:63)
    at android.databinding.tool.store.LayoutInfoInput$deps$2.invoke(LayoutInfoInput.kt:30)
    at kotlin.UnsafeLazyImpl.getValue(Lazy.kt:154)
    at android.databinding.tool.store.LayoutInfoInput.getDeps(LayoutInfoInput.kt)
    at android.databinding.tool.store.LayoutInfoInput$existingBindingClasses$2.invoke(LayoutInfoInput.kt:86)
    at android.databinding.tool.store.LayoutInfoInput$existingBindingClasses$2.invoke(LayoutInfoInput.kt:30)
    at kotlin.UnsafeLazyImpl.getValue(Lazy.kt:154)
    at android.databinding.tool.store.LayoutInfoInput.getExistingBindingClasses(LayoutInfoInput.kt)
    at android.databinding.tool.BaseDataBinder.<init>(BaseDataBinder.kt:40)
    at com.android.build.gradle.internal.tasks.databinding.DataBindingGenBaseClassesTask$CodeGenerator.run(DataBindingGenBaseClassesTask.kt:203)
    at com.android.build.gradle.internal.tasks.databinding.DataBindingGenBaseClassesTask.writeBaseClasses(DataBindingGenBaseClassesTask.kt:100)
    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:50)
    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:124)
    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:113)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95)
    ... 33 more

Help would be appreciated!

Unblinking answered 3/1, 2019 at 7:37 Comment(3)
share your code as wellIto
Does this error while executing a Gradle task? If so, include your build.gradle file.Pint
It might just be an android thing here, not into it, but the error also happens when you try to get a file from a path that just is not there. You might be on another machine than you think you are. Check the working directory and find out whether the paths to all needed files are right. See Parameter 'directory' is not a directory for a parameter which is a directory, with other answers as well.Disruption
S
92

I've had the same problem. All I did was:

  1. Delete the .gradle directory under the project root files
  2. Invalidate Caches and restart Android Studio.
Slave answered 10/9, 2019 at 14:18 Comment(4)
To clarify, the .gradle directory is under the project instead of the one under user's home directory.Alveraalverez
Very weird, changed branches and saw this for the first time. Thank you for the solution.Misapply
As in case of gentleman above, my build broke after just switching between git branches, and this answer helps.Molecular
The tip for .gradle under project dir was helpful, as I thought people meant the home dir .gradle, which didn't fix it for mePooi

© 2022 - 2024 — McMap. All rights reserved.