gpt4 book ai didi

android - java.lang.NoSuchMethodError : com. 谷歌.common.io.Files.asCharSink

转载 作者:行者123 更新时间:2023-11-29 01:37:52 25 4
gpt4 key购买 nike

自从我将 Android Studio 更新到 9.1 和 gradle 14.+ 后,我收到了这个错误:

我正在对我的项目执行任务 assembleRelease。这是我得到的:

* What went wrong:
Execution failed for task ':app:dexParisRelease'.
> com.google.common.io.Files.asCharSink(Ljava/io/File;Ljava/nio/charset/Charset;[Lcom/google/common/io/FileWriteMode;)Lcom/google/common/io/CharSink;

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:dexParisRelease'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:305)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
Caused by: java.lang.NoSuchMethodError: com.google.common.io.Files.asCharSink(Ljava/io/File;Ljava/nio/charset/Charset;[Lcom/google/common/io/FileWriteMode;)Lcom/google/common/io/CharSink;
at com.android.builder.core.AndroidBuilder.getFilesToAdd(AndroidBuilder.java:1429)
at com.android.builder.core.AndroidBuilder.convertByteCode(AndroidBuilder.java:1408)
at com.android.builder.core.AndroidBuilder$convertByteCode$4.call(Unknown Source)
at com.android.build.gradle.tasks.Dex.doTaskAction(Dex.groovy:136)
at com.android.build.gradle.tasks.Dex.this$5$doTaskAction(Dex.groovy)
at com.android.build.gradle.tasks.Dex$this$5$doTaskAction.callCurrent(Unknown Source)
at com.android.build.gradle.tasks.Dex.taskAction(Dex.groovy:79)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:235)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:211)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:222)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:200)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 13 more

有什么想法吗?

最佳答案

您同时使用两个不同版本的 Guava。

您的堆栈跟踪不完整,所以我无法完整回答。另外,我不知道 Android Studio。

但是,我可以读取您的堆栈跟踪,并且我看到类 AndroidBuilder 正在尝试访问方法 com.google.common.io.Files.asCharSink .方法 asCharSink 存在于 Guava 14 中。

通常,当您弄乱依赖项时,就会发生错误。

鉴于您看到一些指示 Gradle 的堆栈跟踪组件并且您提到使用 Gradle,我认为您在使用 Gradle 构建时遇到了这个问题。

所以我认为您实际上并没有弄乱依赖关系,而是您的 gradle 版本(需要 Guava 14 或更高版本)与实际加载到构建器类路径中的 Guava 之间不兼容。

因此检查 Gradle 的调用方式并将该工具的 Guava 版本更新为 14 或更高版本。

关于android - java.lang.NoSuchMethodError : com. 谷歌.common.io.Files.asCharSink,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26737853/

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