java.nio.file.DirectoryNotEmptyException错误

时间:2018-12-05 14:16:46

标签: java android android-studio

  

java.lang.RuntimeException:java.nio.file.DirectoryNotEmptyException:C:\ Users \ USER \ AndroidStudioProjects \ Jadayu \ app \ build \ intermediates \ transforms \ instantRun \ debug \ 0 \ com \ google \ android \ gms \ analyticsservices \ app \ library       在com.android.builder.profile.Recorder $ Block.handleException(Recorder.java:55)       在com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:104)       在com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:230)       在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)       在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.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)       在org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)       在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.nio.file.DirectoryNotEmptyException:C:\ Users \ USER \ AndroidStudioProjects \ Jadayu \ app \ build \ intermediates \ transforms \ instantRun \ debug \ 0 \ com \ google \ android \ gms \ analyticsservices \ app \ library       在sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:266)       在sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108)       在java.nio.file.Files.deleteIfExists(Files.java:1165)       在com.android.utils.PathUtils.deleteRecursivelyIfExists(PathUtils.java:58)       在com.android.utils.PathUtils.deleteRecursivelyIfExists(PathUtils.java:53)       在com.android.utils.PathUtils.deleteRecursivelyIfExists(PathUtils.java:53)       在com.android.utils.PathUtils.deleteRecursivelyIfExists(PathUtils.java:53)       在com.android.utils.PathUtils.deleteRecursivelyIfExists(PathUtils.java:53)       在com.android.utils.PathUtils.deleteRecursivelyIfExists(PathUtils.java:53)       在com.android.utils.PathUtils.deleteRecursivelyIfExists(PathUtils.java:53)       在com.android.utils.FileUtils.deleteRecursivelyIfExists(FileUtils.java:238)       在com.android.utils.FileUtils.deletePath(FileUtils.java:59)       在com.android.utils.FileUtils.deleteDirectoryContents(FileUtils.java:74)       在com.android.utils.FileUtils.cleanOutputDir(FileUtils.java:101)       在com.android.build.gradle.internal.transforms.InstantRunTransform.doTransform(InstantRunTransform.java:271)       在com.android.build.gradle.internal.transforms.InstantRunTransform.transform(InstantRunTransform.java:186)       在com.android.build.gradle.internal.pipeline.TransformTask $ 2.call(TransformTask.java:239)       在com.android.build.gradle.internal.pipeline.TransformTask $ 2.call(TransformTask.java:235)       在com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)       ...还有49个

我遇到了这个错误,我该怎么做才能解决此问题

3 个答案:

答案 0 :(得分:2)

  1. 执行内部版本->干净内部版本
  2. 如果没有运气,请尝试,文件->尝试使缓存无效并重新启动

答案 1 :(得分:0)

请使用代码标签,并在发生问题的地方分享有关您的代码的部分内容。有一些关于您的问题的错误报告。参见:this

答案 2 :(得分:0)

posting() { this.http.post<any>(this.baseurl).map(res:Response=>{res.json();}); } ngOnInit() { this.appService.posting().subscribe(data=>this.p=data); } 表示其中包含一些文件,由于权限或具有互斥锁的文件(由于它们是打开的),因此无法删除。

要解决此问题,请手动关闭Android Studio和删除目录DirectoryNotEmptyException