为啥 ./gradlew :processDebugUnitTestManifest 失败?

Posted

技术标签:

【中文标题】为啥 ./gradlew :processDebugUnitTestManifest 失败?【英文标题】:Why is ./gradlew :processDebugUnitTestManifest failing?为什么 ./gradlew :processDebugUnitTestManifest 失败? 【发布时间】:2021-12-13 04:36:21 【问题描述】:

在本地导入另一个库的 android 库中运行以下命令:

$ ./gradlew votepeer:processDebugUnitTestManifest --stacktrace

产生以下结果。但我不知道为什么!

以下 sn-ps 是通过使用 stacktrace 运行 processDebugUnitTestManifest-command 来挽救的

这可能是通过 settings.gradle 在本地导入另一个 android 库的问题。

> Task :votepeer:processDebugUnitTestManifest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':votepeer:processDebugUnitTestManifest'.
> Manifest merging exception

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

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':votepeer:processDebugUnitTestManifest'.
Caused by: java.lang.RuntimeException: Manifest merging exception
        at com.android.build.gradle.tasks.ProcessTestManifest.mergeManifestsForTestVariant(ProcessTestManifest.kt:305)
        at com.android.build.gradle.tasks.ProcessTestManifest.doFullTaskAction(ProcessTestManifest.kt:111)
        at com.android.build.gradle.internal.tasks.IncrementalTask.handleIncrementalInputs(IncrementalTask.kt:110)
        at com.android.build.gradle.internal.tasks.IncrementalTask.access$handleIncrementalInputs(IncrementalTask.kt:64)
        at com.android.build.gradle.internal.tasks.IncrementalTask$taskAction$$inlined$recordTaskAction$1.invoke(BaseTask.kt:62)
        at com.android.build.gradle.internal.tasks.Blocks.recordSpan(Blocks.java:51)
        at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction$gradle_core(IncrementalTask.kt:141)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
Caused by: java.io.FileNotFoundException: /Users/jqrgen/dev/bu/voter/libbitcoincashkotlin/libbitcoincash/build/intermediates/navigation_json/debug/navigation.json (No such file or directory)
        at com.google.common.io.Files$FileByteSource.openStream(Files.java:130)
        at com.google.common.io.Files$FileByteSource.openStream(Files.java:120)
        at com.google.common.io.ByteSource$AsCharSource.openStream(ByteSource.java:460)
        at com.google.common.io.CharSource.readLines(CharSource.java:359)
        at com.google.common.io.Files.readLines(Files.java:558)
        at com.android.utils.FileUtils.loadFileWithUnixLineSeparators(FileUtils.java:378)
        at com.android.manifmerger.ManifestMerger2.createNavigationMap(ManifestMerger2.java:496)
        ... 232 more


* Get more help at https://help.gradle.org

BUILD FAILED in 2s
3 actionable tasks: 1 executed, 2 up-to-date

【问题讨论】:

【参考方案1】:

一般来说,看看是什么错误,可以在Android studio中看到合并的Manifest File

AndroidManifest 文件:

点击底部标签“Merged Manifest”

在右侧屏幕的“其他清单文件”中,检查是否存在由于 griddle 引起的错误:

【讨论】:

以上是关于为啥 ./gradlew :processDebugUnitTestManifest 失败?的主要内容,如果未能解决你的问题,请参考以下文章

gradlew 命令

gradlew:权限被拒绝

为啥将具有运行时范围的库添加到 debugCompileClasspath?

gradlew和gradle的区别

react-native在mac上执行gradlew命令报错 ./gradlew: command not found

Travis.yml ./gradlew:权限被拒绝