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!

3
  • share your code as well Commented Jan 3, 2019 at 7:53
  • 1
    Does this error while executing a Gradle task? If so, include your build.gradle file. Commented Jan 3, 2019 at 8:59
  • 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. Commented Jan 22, 2023 at 21:22

1 Answer 1

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.
Sign up to request clarification or add additional context in comments.

4 Comments

To clarify, the .gradle directory is under the project instead of the one under user's home directory.
Very weird, changed branches and saw this for the first time. Thank you for the solution.
As in case of gentleman above, my build broke after just switching between git branches, and this answer helps.
The tip for .gradle under project dir was helpful, as I thought people meant the home dir .gradle, which didn't fix it for me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.