gpt4 book ai didi

android - org.gradle.api.GradleException:无法在Android Studio 3.5.2上读取路径和java.nio.FileAccessDeniedException

转载 作者:行者123 更新时间:2023-12-03 05:31:45 26 4
gpt4 key购买 nike

请仔细阅读。这不是重复项。我花了无数小时在互联网上搜索该问题的解决方案。
它始于android studio 3.3。所以我将android studio更新到了最新的3.5.2版本,并将gradle更新到了5.4.1版本,并将android gradle插件更新了到3.5.2,但错误仍然存​​在。

当我单击同步项目时,它成功同步,但是当我要运行该应用程序时,它将引发异常:任务':app:mergeDebugResources'的执行失败
我使用--debug选项和--stacktrace来运行它以获得更多的见解。

这是堆栈跟踪:

org.gradle.api.tasks.TaskExecutionException:任务':app:mergeDebugResources'的执行失败。
在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter $ 3.accept(ExecuteActionsTaskExecuter.java:151)
在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter $ 3.accept(ExecuteActionsTaskExecuter.java:148)
在org.gradle.internal.Try $ Failure.ifSuccessfulOrElse(Try.java:191)
在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:141)
在org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionStateTaskExecuter.execute(ResolveBeforeExecutionStateTaskExecuter.java:75)
在org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
在org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108)
在org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)
在org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46)处
在org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:94)
在org.gradle.execution.plan.DefaultPlanExecutor $ ExecutorWorker $ 1.execute(DefaultPlanExecutor.java:129)
在org.gradle.execution.plan.DefaultPlanExecutor $ ExecutorWorker.execute(DefaultPlanExecutor.java:202)处
在org.gradle.execution.plan.DefaultPlanExecutor $ ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
在org.gradle.execution.plan.DefaultPlanExecutor $ ExecutorWorker.run(DefaultPlanExecutor.java:129)
在org.gradle.execution.plan.DefaultPlanExecutor.process(DefaultPlanExecutor.java:74)
在org.gradle.execution.taskgraph.DefaultTaskExecutionGraph.executeWithServices(DefaultTaskExecutionGraph.java:178)处
在org.gradle.execution.taskgraph.DefaultTaskExecutionGraph.execute(DefaultTaskExecutionGraph.java:154)处
在org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:41)
在org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:40)
在org.gradle.execution.DefaultBuildExecuter.access $ 000(DefaultBuildExecuter.java:24)
在org.gradle.execution.DefaultBuildExecuter $ 1.proceed(DefaultBuildExecuter.java:46)
在org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:49)
在org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:40)
在org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:33)
在org.gradle.initialization.DefaultGradleLauncher $ ExecuteTasks.run(DefaultGradleLauncher.java:383)
在org.gradle.internal.operations.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)处
在org.gradle.internal.operations.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)处
在org.gradle.internal.operations.DefaultBuildOperationExecutor $ 1.execute(DefaultBuildOperationExecutor.java:165)
在org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)处
在org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
在org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
在org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
在org.gradle.initialization.DefaultGradleLauncher.runTasks(DefaultGradleLauncher.java:247)
在org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:159)
在org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:134)
在org.gradle.internal.invocation.GradleBuildController $ 1.execute(GradleBuildController.java:58)
在org.gradle.internal.invocation.GradleBuildController $ 1.execute(GradleBuildController.java:55)
在org.gradle.internal.invocation.GradleBuildController $ 3.create(GradleBuildController.java:82)
在org.gradle.internal.invocation.GradleBuildController $ 3.create(GradleBuildController.java:75)
在org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:183)
在org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:40)
在org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:75)
在org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:55)
在org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:54)
在org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
在org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
在org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:58)
在org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
在org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:39)
在org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner $ 3.call(RunAsBuildOperationBuildActionRunner.java:51)
在org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner $ 3.call(RunAsBuildOperationBuildActionRunner.java:45)
在org.gradle.internal.operations.DefaultBuildOperationExecutor $ CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
在org.gradle.internal.operations.DefaultBuildOperationExecutor $ CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)处
在org.gradle.internal.operations.DefaultBuildOperationExecutor $ 1.execute(DefaultBuildOperationExecutor.java:165)
在org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)处
在org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
在org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
在org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
在org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:45)

at org.gradle.internal.snapshot.impl.DefaultFileSystemSnapshotter$FileCollectionLeafVisitorImpl.visitCollection(DefaultFileSystemSnapshotter.java:241)
at org.gradle.api.internal.file.AbstractFileCollection.visitLeafCollections(AbstractFileCollection.java:233)
at org.gradle.internal.snapshot.impl.DefaultFileSystemSnapshotter.snapshot(DefaultFileSystemSnapshotter.java:126)
at org.gradle.internal.fingerprint.impl.AbstractFileCollectionFingerprinter.fingerprint(AbstractFileCollectionFingerprinter.java:48)
at org.gradle.api.internal.artifacts.transform.DefaultTransformerInvoker.snapshotOutputs(DefaultTransformerInvoker.java:429)
at org.gradle.api.internal.artifacts.transform.DefaultTransformerInvoker.lambda$invoke$2(DefaultTransformerInvoker.java:127)
at org.gradle.api.internal.artifacts.transform.DefaultTransformerInvoker.fireTransformListeners(DefaultTransformerInvoker.java:219)
at org.gradle.api.internal.artifacts.transform.DefaultTransformerInvoker.lambda$invoke$3(DefaultTransformerInvoker.java:117)
at org.gradle.api.internal.artifacts.transform.ImmutableTransformationWorkspaceProvider.lambda$withWorkspace$0(ImmutableTransformationWorkspaceProvider.java:81)
at org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess.withFileLock(LockOnDemandCrossProcessCacheAccess.java:90)
at org.gradle.cache.internal.DefaultCacheAccess.withFileLock(DefaultCacheAccess.java:194)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.withFileLock(DefaultPersistentDirectoryStore.java:170)
at org.gradle.cache.internal.DefaultCacheFactory$ReferenceTrackingCache.withFileLock(DefaultCacheFactory.java:194)
at org.gradle.api.internal.artifacts.transform.ImmutableTransformationWorkspaceProvider.withWorkspace(ImmutableTransformationWorkspaceProvider.java:76)
at org.gradle.api.internal.artifacts.transform.AbstractCachingTransformationWorkspaceProvider.lambda$withWorkspace$0(AbstractCachingTransformationWorkspaceProvider.java:54)
at com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4717)
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3444)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2193)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2152)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2042)
... 27 more

造成原因:java.nio.file.AccessDeniedException:C:\ Users \ Freeborn.gradle \ caches \ transforms-2 \ files-2.1 \ 5bfb0b3279bf9321cb7d837f84317b2f \ aapt2-3.5.2-5435860-windows
...还有56个

从上面的最后一部分,有一个java.nio.file.AccessDeniedException C; \ users \ freeborn.gradle \ caches

我认为可能是问题所在。我在资源管理器上打开了该文件夹,该文件夹显示访问被拒绝。
我尝试删除该文件夹,但仍然无法正常工作。我重新启动计算机,问题仍然存在。我无法删除文件夹,无法更改文件夹的权限设置,它说我无权更改文件夹的权限设置,因此无法声明所有权。

看来我是唯一遇到此问题的人。

这是主要问题:

无法解析配置':app:_internal_aapt2_binary'的所有文件。

Failed to transform artifact 'aapt2-windows.jar (com.android.tools.build:aapt2:3.5.2-5435860)' to match attributes {artifactType=_internal-android-aapt2-binary, org.gradle.usage=java-runtime-jars}. org.gradle.api.GradleException: Could not read path 'C:\Users\Freeborn.gradle\caches\transforms-2\files-2.1\5bfb0b3279bf9321cb7d837f84317b2f\aapt2-3.5.2-5435860-windows'.



我已经尝试了一切,但现在我不知道该怎么办。如果我尝试降级gradle版本,它将暂时起作用,稍后问题将再次出现。

最佳答案

尝试将gradle缓存位置更改为您有权访问的目录(例如其他驱动器,桌面或文档中的文件夹等)。您可以通过将GRADLE_USER_HOME环境变量设置为该新位置来实现。

关于android - org.gradle.api.GradleException:无法在Android Studio 3.5.2上读取路径和java.nio.FileAccessDeniedException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59006086/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com