构建时发生Android数据绑定错误

时间:2019-01-09 19:59:47

标签: android android-databinding

由于此错误,我无法构建项目。我从一个片段中删除了数据绑定实现,但是现在项目无法构建。我没有检查任何东西,仔细检查了布局。

在运行任务->:app:dataBindingGenBaseClassesMockDebug->执行writeBaseClasses时抛出错误

到目前为止,我尝试清理,构建项目,重新启动缓存并使它们无效,无论如何重新导入项目都显示相同的错误,而没有任何提示是什么错误

  

参数“目录”不是目录

     

org.gradle.api.tasks.TaskExecutionException:任务':app:dataBindingGenBaseClassesMockDebug'的执行失败。       在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103)       在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)       在org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)处       在org.gradle.api.internal.tasks.execution.SkipCachedTaskExecuter.execute(SkipCachedTaskExecuter.java:103)       在org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)       在org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)       在org.gradle.api.internal.tasks.execution.ResolveBuildCacheKeyExecuter.execute(ResolveBuildCacheKeyExecuter.java:66)       在org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)       在org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)处       在org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)       在org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)       在org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)处       在org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)       在org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)       在org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)       在org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)       在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker $ 1.run(DefaultTaskGraphExecuter.java:256)       在org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)处       在org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)       在org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)       在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)       在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:249)处       在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238)处       在org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)处       在org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker.access $ 200(DefaultTaskPlanExecutor.java:79)       在org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker $ 1.execute(DefaultTaskPlanExecutor.java:104)       在org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker $ 1.execute(DefaultTaskPlanExecutor.java:98)       在org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:663)处       在org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:597)       在org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)       在org.gradle.internal.concurrent.ExecutorPolicy $ CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)       在org.gradle.internal.concurrent.ManagedExecutorImpl $ 1.run(ManagedExecutorImpl.java:46)       在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)       在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)       在org.gradle.internal.concurrent.ThreadFactoryImpl $ ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)       在java.lang.Thread.run(Thread.java:745)   原因:java.lang.IllegalArgumentException:参数“ directory”不是目录       在org.apache.commons.io.FileUtils.validateListFilesParameters(FileUtils.java:545)       在org.apache.commons.io.FileUtils.listFiles(FileUtils.java:521)       在android.databinding.tool.store.ResourceBundle.loadClassInfoFromFolder(ResourceBundle.java:157)       在android.databinding.tool.store.LayoutInfoInput $ deps $ 2.invoke(LayoutInfoInput.kt:63)       在android.databinding.tool.store.LayoutInfoInput $ deps $ 2.invoke(LayoutInfoInput.kt:30)       在kotlin.UnsafeLazyImpl.getValue(Lazy.kt:154)       在android.databinding.tool.store.LayoutInfoInput.getDeps(LayoutInfoInput.kt)       在android.databinding.tool.store.LayoutInfoInput $ existingBindingClasses $ 2.invoke(LayoutInfoInput.kt:86)       在android.databinding.tool.store.LayoutInfoInput $ existingBindingClasses $ 2.invoke(LayoutInfoInput.kt:30)       在kotlin.UnsafeLazyImpl.getValue(Lazy.kt:154)       在android.databinding.tool.store.LayoutInfoInput.getExistingBindingClasses(LayoutInfoInput.kt)       在android.databinding.tool.BaseDataBinder。(BaseDataBinder.kt:40)       在com.android.build.gradle.internal.tasks.databinding.DataBindingGenBaseClassesTask $ CodeGenerator.run(DataBindingGenBaseClassesTask.kt:203)       在com.android.build.gradle.internal.tasks.databinding.DataBindingGenBaseClassesTask.writeBaseClasses(DataBindingGenBaseClassesTask.kt:100)       在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处       在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)       在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)       在java.lang.reflect.Method.invoke(Method.java:498)       在org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)       在org.gradle.api.internal.project.taskfactory.IncrementalTask​​Action.doExecute(IncrementalTask​​Action.java:50)       在org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)       在org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)       在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter $ 1.run(ExecuteActionsTaskExecuter.java:124)       在org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)处       在org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)       在org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)       在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)       在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:113)处       在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95)       ...另外35个

4 个答案:

答案 0 :(得分:8)

删除.gradle目录,然后使Android Studio无效并重新启动。

答案 1 :(得分:3)

在我的一个项目中移动一堆东西时,我遇到了这个问题。什么都没用:无效/重新启动,取消所有gradle缓存,清除AS缓存/设置等。

然后我的一位同事建议:git clean -fdx,然后重新启动Android Studio,它成功了。它使您的树中任何原本不是来自您的回购协议的东西都变核。

答案 2 :(得分:0)

我找到了解决方案,但没有意义。 当我从android studio中删除该项目并重新导入该项目时,问题已解决。但是,我删除了构建文件夹或尝试重新启动并使其无效的缓存无效。希望对您有帮助

答案 3 :(得分:0)

在类似Unix的系统(Linux或BSD)上,请执行以下操作:

  1. 退出Android Studio(或至少关闭项目)
  2. 打开一个终端
  3. 输入以下命令:

rm -rf .gradle .idea $( find . -name build -type d ) $( find . -name *.iml -type f )

  1. 再次从Android Studio导入项目