gpt4 book ai didi

android - 使用 Gradle 构建会抛出 MalformedJsonException

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:30:56 29 4
gpt4 key购买 nike

每当我尝试使用 Gradle 构建我的项目时,我都会收到此错误

:app:mergeDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Error: com.google.common.util.concurrent.UncheckedExecutionException: java.lang.RuntimeException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1

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

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:mergeDebugResources'.
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:310)
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.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: com.android.build.gradle.tasks.ResourceException: Error: com.google.common.util.concurrent.UncheckedExecutionException: java.lang.RuntimeException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1
at com.android.build.gradle.tasks.MergeResources.doFullTaskAction(MergeResources.java:164)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:104)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:243)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:219)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:230)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:208)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 14 more
Caused by: Error: com.google.common.util.concurrent.UncheckedExecutionException: java.lang.RuntimeException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1
at com.android.ide.common.res2.MergeWriter.end(MergeWriter.java:54)
at com.android.ide.common.res2.MergedResourceWriter.end(MergedResourceWriter.java:129)
at com.android.ide.common.res2.DataMerger.mergeData(DataMerger.java:291)
at com.android.ide.common.res2.ResourceMerger.mergeData(ResourceMerger.java:48)
at com.android.build.gradle.tasks.MergeResources.doFullTaskAction(MergeResources.java:157)
... 22 more
Caused by: java.lang.RuntimeException: com.google.common.util.concurrent.UncheckedExecutionException: java.lang.RuntimeException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1
at com.android.ide.common.internal.WaitableExecutor.waitForTasksWithQuickFail(WaitableExecutor.java:117)
at com.android.ide.common.res2.MergeWriter.end(MergeWriter.java:50)
... 26 more
Caused by: com.google.common.util.concurrent.UncheckedExecutionException: java.lang.RuntimeException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2201)
at com.google.common.cache.LocalCache.get(LocalCache.java:3934)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821)
at com.android.ide.common.blame.MergingLog.getWholeFileMap(MergingLog.java:128)
at com.android.ide.common.blame.MergingLog.logCopy(MergingLog.java:88)
at com.android.ide.common.blame.MergingLog.logCopy(MergingLog.java:98)
at com.android.ide.common.res2.MergedResourceWriter$1.call(MergedResourceWriter.java:215)
at com.android.ide.common.res2.MergedResourceWriter$1.call(MergedResourceWriter.java:171)
Caused by: java.lang.RuntimeException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1
at com.android.ide.common.blame.MergingLogPersistUtil.loadFromSingleFile(MergingLogPersistUtil.java:293)
at com.android.ide.common.blame.MergingLog$1.load(MergingLog.java:55)
at com.android.ide.common.blame.MergingLog$1.load(MergingLog.java:52)
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195)
... 8 more
Caused by: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1
at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1505)
at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1386)
at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:572)
at com.google.gson.stream.JsonReader.beginArray(JsonReader.java:332)
at com.android.ide.common.blame.MergingLogPersistUtil.loadFromSingleFile(MergingLogPersistUtil.java:266)
... 14 more


BUILD FAILED

我从事这个项目已经将近一年了,这是我第一次看到使用 Gradle 构建这个问题。 Google 也不会返回任何有用的结果。

我的电脑硬盘停止响应,所以我不得不在 Android Studio 打开时强制关机,这可能与问题有关。

采取的步骤:

  • 重启 Android Studio

  • 使缓存失效并重启

  • 删除主目录中的 .gradle 文件夹

这非常令人恼火,我似乎找不到解决办法。感谢您的帮助!

最佳答案

您是否尝试清理项目并再次重新运行?

关于android - 使用 Gradle 构建会抛出 MalformedJsonException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33284874/

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