Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱
MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina.com

gradlew 命令行 build 调试 构建错误 Manifest merger failed MD


目录

解决 Manifest merger failed 问题

在android开发的时候,有时候会遇到这样的问题:

Manifest merger failed with multiple errors, see logs



但是要命的是,你管你怎么找,除了这个log,再没有什么其他的有用信息了,怎么办?

处理方式是这样的:

首先进入命令行,输入命令

gradlew processDebugManifest --stacktrace

PS:

Run gradlew tasks to get a list of available tasks.

Run with 【--stacktrace】 option to get the stack trace.

Run with 【--info】 or 【--debug】 option to get more log output.

Run with 【--scan】 to get full insights.

其中,processDebugManifest 是用于调试清单文件的,这个命令会获取更多的log信息。

然后会输出很多信息,其中有用的是这一部分:

> Task :app:processDebugManifest FAILED
C:\Android\_coder\_workspace_as\DDComponent_Simple\app\src\main\AndroidManifest.xml:6:5-20:19 Error:
tools:replace specified at line:6 for attribute android:theme, but no new value specified
C:\Android\_coder\_workspace_as\DDComponent_Simple\app\src\main\AndroidManifest.xml Error:
Validation failed, exiting
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

卧槽,一看我就明白了,原来是这里写错了:

<application
android:name=".MyApplication"
android:allowBackup="false"
android:icon="@drawable/app_icon"
android:label="@string/app_app_name"
tools:ignore="GoogleAppIndexingWarning"
tools:replace="android:icon,android:theme,android:label,android:allowBackup">

本来 replace 是用于合并清单文件时替换依赖库或子模块中的配置的,但是这里因为没有指定 theme ,所以替换时就会因找不到 theme 而报错。

修改方式当然相应的有两种,一种是指定 theme,另一种是不替换 theme。

使用 gradlew 命令调试构建过程

gradlew 命令可配置的参数

执行【gradlew --help】命令可获取 gradlew 命令可配置的参数

USAGE: gradlew [option...] [task...]

-?, -h, --help Shows this help message.
-a, --no-rebuild Do not rebuild project dependencies. [deprecated]
-b, --build-file Specify the build file.
--build-cache Enables the Gradle build cache. Gradle will try to reuse outputs from previous builds. [incubating]
-c, --settings-file Specify the settings file.
--configure-on-demand Configure necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds. [incubating]
--console Specifies which type of console output to generate. Values are 'plain', 'auto' (default), 'rich' or 'verbose'.
--continue Continue task execution after a task failure.
-D, --system-prop Set system property of the JVM (e.g. -Dmyprop=myvalue).
-d, --debug Log in debug mode (includes normal stacktrace).
--daemon Uses the Gradle Daemon to run the build. Starts the Daemon if not running.
--foreground Starts the Gradle Daemon in the foreground. [incubating]
-g, --gradle-user-home Specifies the gradle user home directory.
-I, --init-script Specify an initialization script.
-i, --info Set log level to info.
--include-build Include the specified build in the composite. [incubating]
-m, --dry-run Run the builds with all task actions disabled.
--max-workers Configure the number of concurrent workers Gradle is allowed to use. [incubating]
--no-build-cache Disables the Gradle build cache. [incubating]
--no-configure-on-demand Disables the use of configuration on demand. [incubating]
--no-daemon Do not use the Gradle daemon to run the build. Useful occasionally if you have configured Gradle to always run with the daemon by default.
--no-parallel Disables parallel execution to build projects. [incubating]
--no-scan Disables the creation of a build scan. For more information about build scans, please visit https://gradle.com/build-scans. [incubating]
--offline Execute the build without accessing network resources.
-P, --project-prop Set project property for the build script (e.g. -Pmyprop=myvalue).
-p, --project-dir Specifies the start directory for Gradle. Defaults to current directory.
--parallel Build projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use. [incubating]
--profile Profile build execution time and generates a report in the <build_dir>/reports/profile directory.
--project-cache-dir Specify the project-specific cache directory. Defaults to .gradle in the root project directory.
-q, --quiet Log errors only.
--recompile-scripts Force build script recompiling. [deprecated]
--refresh-dependencies Refresh the state of dependencies.
--rerun-tasks Ignore previously cached task results.
-S, --full-stacktrace Print out the full (very verbose) stacktrace for all exceptions.
-s, --stacktrace Print out the stacktrace for all exceptions.
--scan Creates a build scan. Gradle will emit a warning if the build scan plugin has not been applied. (https://gradle.com/build-scans) [incubating]
--status Shows status of running and recently stopped Gradle Daemon(s).
--stop Stops the Gradle Daemon if it is running.
-t, --continuous Enables continuous build. Gradle does not exit and will re-execute tasks when task file inputs change. [incubating]
-u, --no-search-upward Don't search in parent folders for a settings file.
-v, --version Print version info.
-w, --warn Set log level to warn.
-x, --exclude-task Specify a task to be excluded from execution.

获取所有 task

执行【gradlew tasks】命令可获取所有 task

To see all tasks and more detail, run gradlew tasks --all

To see more detail about a task, run gradlew help --task

> Task :tasks
------------------------------------------------------------
All tasks runnable from root project
------------------------------------------------------------ Android tasks
-------------
androidDependencies - Displays the Android dependencies of the project.
signingReport - Displays the signing info for each variant.
sourceSets - Prints out all the source sets defined in this project. Build tasks
-----------
assemble - Assembles all variants of all applications and secondary packages.
assembleAndroidTest - Assembles all the Test applications.
assembleDebug - Assembles all Debug builds.
assembleRelease - Assembles all Release builds.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
clean - Deletes the build directory.
cleanBuildCache - Deletes the build cache directory.
compileDebugAndroidTestSources
compileDebugSources
compileDebugUnitTestSources
compileReleaseSources
compileReleaseUnitTestSources
mockableAndroidJar - Creates a version of android.jar that's suitable for unit tests. Build Setup tasks
-----------------
init - Initializes a new Gradle build.
wrapper - Generates Gradle wrapper files. Help tasks
----------
buildEnvironment - Displays all buildscript dependencies declared in root project 'RxJavaDemo'.
components - Displays the components produced by root project 'RxJavaDemo'. [incubating]
dependencies - Displays all dependencies declared in root project 'RxJavaDemo'.
dependencyInsight - Displays the insight into a specific dependency in root project 'RxJavaDemo'.
dependentComponents - Displays the dependent components of components in root project 'RxJavaDemo'. [incubating]
help - Displays a help message.
model - Displays the configuration model of root project 'RxJavaDemo'. [incubating]
projects - Displays the sub-projects of root project 'RxJavaDemo'.
properties - Displays the properties of root project 'RxJavaDemo'.
tasks - Displays the tasks runnable from root project 'RxJavaDemo' (some of the displayed tasks may belong to subprojects). Install tasks
-------------
installDebug - Installs the Debug build.
installDebugAndroidTest - Installs the android (on device) tests for the Debug build.
uninstallAll - Uninstall all applications.
uninstallDebug - Uninstalls the Debug build.
uninstallDebugAndroidTest - Uninstalls the android (on device) tests for the Debug build.
uninstallRelease - Uninstalls the Release build. Verification tasks
------------------
check - Runs all checks.
connectedAndroidTest - Installs and runs instrumentation tests for all flavors on connected devices.
connectedCheck - Runs all device checks on currently connected devices.
connectedDebugAndroidTest - Installs and runs the tests for debug on connected devices.
deviceAndroidTest - Installs and runs instrumentation tests using all Device Providers.
deviceCheck - Runs all device checks using Device Providers and Test Servers.
lint - Runs lint on all variants.
lintDebug - Runs lint on the Debug build.
lintRelease - Runs lint on the Release build.
lintVitalRelease - Runs lint on just the fatal issues in the release build.
test - Run unit tests for all variants.
testDebugUnitTest - Run unit tests for the debug build.
testReleaseUnitTest - Run unit tests for the release build.

获取 task 执行过程的详细信息

可以使用以下几个参数中的一个【--stacktrace】【--info】【--debug】【--scan】

例如【gradlew assembleDebug --stacktrace】可以获取 build 过程的详细信息

例如【gradlew processDebugManifest --stacktrace】可以获取 Manifest 检查、合并过程的详细信息

一般用来处理在build时报错但有没有提示具体是什么错时使用,根据经验,通过这种方式基本能获取非常精确的错误信息。

第一次使用(并非是整个PC环境的第一次使用,往往是你AS每次启动后的第一次使用)的时候可能非常慢,因为需要下载大量的文件,不过一般都是正常下载的,应该很少出现下一半下载失败的问题。

2018-8-20

gradlew 命令行 build 调试 构建错误 Manifest merger failed MD的更多相关文章

  1. AS错误:Manifest merger failed with multiple errors, see logs

    gradlew processDebugManifest --stacktrace 在as命令行输入 回车看到 往上滑, 就能看到错误的详细信息,图中这个错误应该不是我原来的错误,是因为我按照网上的方 ...

  2. (转)Unity3D命令行Build

    转自:http://www.cnblogs.com/gameprogram/archive/2012/05/11/2496303.html 本来是没想用这个命令行Build方式,可惜电脑不知道怎么的就 ...

  3. Unity3D命令行Build

    转自:http://www.cnblogs.com/gameprogram/archive/2012/05/11/2496303.html 本来是没想用这个命令行Build方式,可惜电脑不知道怎么的就 ...

  4. 无法从命令行或调试器启动服务,必须首先安装Windows服务(使用installutil.exe),然后用ServerExplorer、Windows服务器管理工具或NET START命令启动它

    无法从命令行或调试器启动服务,必须首先安装Windows服务(使用installutil.exe),然后用ServerExplorer.Windows服务器管理工具或NET START命令启动它 1. ...

  5. 错误:“Manifest merger failed with multiple errors, see logs”

    今天用Android Studio打开以前写个的项目后,出现如下错误:Manifest merger failed with multiple errors, see logs 现象是:  遇到这个问 ...

  6. android开发里跳过的坑——android studio 错误Error:Execution failed for task ':processDebugManifest'. > Manifest merger failed with multiple errors, see logs

    使用AS在gradle里配置了多个定制版本,发现在编译版本切换时,会出现错误: Error:Execution failed for task ':processDebugManifest'.> ...

  7. Manifest merger failed : uses-sdk:minSdkVersion 9 cannot be smaller than version 10 declared in library

    Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed : uses-sdk: ...

  8. Manifest merger failed : Attribute application@icon value=(@mipmap/ic_launcher) from AndroidManifest

    情况是这样子的,导入一个比较老的项目(两年前),它依赖于一个 Libraray,已经先导入了 library,现在导入项目的时候出了错 (1) Android Studio 目前提供将 SDK包成 . ...

  9. android studio - Manifest merger failed with multiple errors, see logs

    今天编译运行的时候遇到了“Error:Execution failed for task ':test:processDebugManifest'.> Manifest merger faile ...

随机推荐

  1. linux安装project lemon测评机

    (写下备用) 机子:xubuntu 16.04 LTS 1.下载lemon github地址:https://github.com/Sojiv/Project_lemon 这里download zip ...

  2. [CC-FNCS]Chef and Churu

    [CC-FNCS]Chef and Churu 题目大意: 一个长度为\(n(n\le10^5)\)的数列\(A_{1\sim n}\),另有\(n\)个函数,第\(i\)个函数会返回数组中标号在\( ...

  3. Java内存泄露分析和解决方案及Windows自带查看工具

    Java内存泄漏是每个Java程序员都会遇到的问题,程序在本地运行一切正常,可是布署到远端就会出现内存无限制的增长,最后系统瘫痪,那么如何最快最好的检测程序的稳定性,防止系统崩盘,作者用自已的亲身经历 ...

  4. haskell学习资料

    Haskell基础语法 Real World Haskell 中文版 Haskell趣学指南

  5. centos上安装elasticsearch 5.5.1 遇到的各种坑

    mac玩得好好滴,一次性启动成功,结果在centos上安装时,遇坑无数,记录一下: 一.只能localhost访问的问题修改 conf\elasticsearch.yml network.host: ...

  6. centos ssh终端下高亮显示git分支名

    #set git branch green=$'\e[1;32m' magenta=$'\e[1;35m' normal_colours=$'\e[m' function find_git_branc ...

  7. STM32F4 SPI with DMA

    STM32F4 SPI with DMA A few people have requested code, so I thought I’d post the code showing how I’ ...

  8. JS本地存储信息的实现方式(localStorage 与 userData)

    详细介绍请看: http://www.cnblogs.com/beiyuu/archive/2011/07/20/js-localstorage-userdata.html 里面涉及到的 demo 代 ...

  9. wifidog交叉编译

    本文主要记录在linux平台下.交叉编译wifidog并在openwrt平台上执行的过程.主要是针对wifidog源代码被改动后. 不得不亲自进行交叉编译移植的时候,所碰到的一些问题. (1)下载源代 ...

  10. 在后台运行rtorrent

    本来一直是用transmission做PT的客户端的,但是transmission的功能实在是太弱了,web-gui显示的信息也实在是太有限.在别人的推荐下,总算下定决心换rtorrent+wtorr ...