manifest.xlm配置错误信息

时间:2022-12-04 19:47:41

浅谈manifest.xlm配置文件application中属性

今天在app中引入新的依赖库时出现一个令人费解的问题,大概意思是说我引入的依赖库中android:icon="@mipmap/ic_launcher" android:label="@string/app_name"依赖库中也有同样的属性,之前对这些属性没有研究过,不是很了解,如今遇见此类问题已经解决,和小伙伴们分享一下!

1、问题重现

如果你的应用中有多个依赖库,并且依赖不全是在gradle里面配置,也就是说有的依赖库使用jar包引入的,那么这时候合并manifest的时候很有可能报错:

情况1:jar包的依赖库中android:icon=""  android:label=""这两个属性和应用中的属性引用不同(例如:jar包中android:icon="@mipmap/ic_launcher" ,应用中android:icon="@drawable/ic_launcher" ),这时候你就会用到tools:replace=""属性,如果两个或两个以上的属性引用不同就会报错

情况2:大家可能都知道Android API Level 8及其以上Android系统提供了为应用程序数据的备份和恢复功能即allowBackup属性,默认只是true,当你的应用设置了此属性false,而依赖库中没有设置此属性也就是true此时合并manifest的时候会冲突,必须使用tools:replace=""属性替换,同样有两个或以上的设置不同就会报错

下面是一种情况的报错信息:

Information:Gradle tasks [:androidChatWidget:generateDebugSources, :androidChatWidget:generateDebugAndroidTestSources, :androidChatWidget:mockableAndroidJar, :androidChatWidget:prepareDebugUnitTestDependencies, :app:generateDevDebugSources, :app:prepareDevDebugUnitTestDependencies, :app:mockableAndroidJar, :app:generateDevDebugAndroidTestSources]
:androidChatWidget:preBuild UP-TO-DATE
:androidChatWidget:preDebugBuild UP-TO-DATE
:androidChatWidget:checkDebugManifest
:app:preBuild UP-TO-DATE
:app:preDevDebugBuild UP-TO-DATE
:app:checkDevDebugManifest
:app:preDevReleaseBuild UP-TO-DATE
:app:preProductDebugBuild UP-TO-DATE
:app:preProductReleaseBuild UP-TO-DATE
:app:generateDevDebugBuildConfig
:androidChatWidget:preDebugAndroidTestBuild UP-TO-DATE
:androidChatWidget:preDebugUnitTestBuild UP-TO-DATE
:androidChatWidget:preReleaseBuild UP-TO-DATE
:androidChatWidget:preReleaseUnitTestBuild UP-TO-DATE
:androidChatWidget:prepareComAndroidSupportSupportV42340Library
:app:generateDevDebugBuildConfig UP-TO-DATE
:app:mergeDevDebugShaders UP-TO-DATE
:androidChatWidget:prepareComAndroidSupportSupportV42340Library UP-TO-DATE
:androidChatWidget:prepareDebugDependencies
:androidChatWidget:compileDebugAidl
:app:compileDevDebugShaders UP-TO-DATE
:app:generateDevDebugAssets UP-TO-DATE
:app:generateDevDebugResValues UP-TO-DATE
:app:preDevDebugUnitTestBuild UP-TO-DATE
:app:prepareDevDebugUnitTestDependencies
:androidChatWidget:compileDebugAidl UP-TO-DATE
:androidChatWidget:compileDebugRenderscript
:app:mockableAndroidJar UP-TO-DATE
:app:preDevDebugAndroidTestBuild UP-TO-DATE
:app:prepareDevDebugAndroidTestDependencies
:androidChatWidget:compileDebugRenderscript UP-TO-DATE
:app:compileDevDebugAndroidTestAidl
:androidChatWidget:generateDebugBuildConfig
:app:compileDevDebugAndroidTestAidl UP-TO-DATE
:app:processDevDebugAndroidTestManifest UP-TO-DATE
:androidChatWidget:generateDebugBuildConfig UP-TO-DATE
:app:compileDevDebugAndroidTestRenderscript
:androidChatWidget:mergeDebugShaders
:app:compileDevDebugAndroidTestRenderscript UP-TO-DATE
:app:generateDevDebugAndroidTestBuildConfig
:androidChatWidget:mergeDebugShaders UP-TO-DATE
:app:generateDevDebugAndroidTestBuildConfig UP-TO-DATE
:androidChatWidget:compileDebugShaders
:app:mergeDevDebugAndroidTestShaders
:androidChatWidget:compileDebugShaders UP-TO-DATE
:androidChatWidget:generateDebugAssets UP-TO-DATE
:app:mergeDevDebugAndroidTestShaders UP-TO-DATE
:androidChatWidget:mergeDebugAssets
:app:compileDevDebugAndroidTestShaders UP-TO-DATE
:androidChatWidget:mergeDebugAssets UP-TO-DATE
:app:generateDevDebugAndroidTestAssets UP-TO-DATE
:androidChatWidget:generateDebugResValues UP-TO-DATE
:app:mergeDevDebugAndroidTestAssets
:androidChatWidget:generateDebugResources UP-TO-DATE
:app:mergeDevDebugAndroidTestAssets UP-TO-DATE
:androidChatWidget:mergeDebugResources
:app:generateDevDebugAndroidTestResValues UP-TO-DATE
:app:generateDevDebugAndroidTestResources UP-TO-DATE
:app:mergeDevDebugAndroidTestResources UP-TO-DATE
:app:processDevDebugAndroidTestResources
:androidChatWidget:mergeDebugResources UP-TO-DATE
:app:processDevDebugAndroidTestResources UP-TO-DATE
:androidChatWidget:processDebugManifest
:app:generateDevDebugAndroidTestSources UP-TO-DATE
:androidChatWidget:processDebugManifest UP-TO-DATE
:androidChatWidget:processDebugResources UP-TO-DATE
:androidChatWidget:generateDebugSources UP-TO-DATE
:androidChatWidget:prepareDebugAndroidTestDependencies
:androidChatWidget:compileDebugAndroidTestAidl UP-TO-DATE
:androidChatWidget:compileDebugNdk UP-TO-DATE
:androidChatWidget:compileLint
:androidChatWidget:copyDebugLint UP-TO-DATE
:androidChatWidget:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:androidChatWidget:compileDebugJavaWithJavac UP-TO-DATE
:androidChatWidget:extractDebugAnnotations UP-TO-DATE
:androidChatWidget:mergeDebugProguardFiles UP-TO-DATE
:androidChatWidget:packageDebugRenderscript UP-TO-DATE
:androidChatWidget:packageDebugResources UP-TO-DATE
:androidChatWidget:processDebugJavaRes UP-TO-DATE
:androidChatWidget:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:androidChatWidget:transformClassesAndResourcesWithSyncLibJarsForDebug UP-TO-DATE
:androidChatWidget:mergeDebugJniLibFolders UP-TO-DATE
:androidChatWidget:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:androidChatWidget:transformNative_libsWithSyncJniLibsForDebug UP-TO-DATE
:androidChatWidget:bundleDebug UP-TO-DATE
:androidChatWidget:compileDebugSources UP-TO-DATE
:androidChatWidget:assembleDebug UP-TO-DATE
:androidChatWidget:processDebugAndroidTestManifest UP-TO-DATE
:androidChatWidget:compileDebugAndroidTestRenderscript UP-TO-DATE
:androidChatWidget:generateDebugAndroidTestBuildConfig UP-TO-DATE
:androidChatWidget:mergeDebugAndroidTestShaders UP-TO-DATE
:androidChatWidget:compileDebugAndroidTestShaders UP-TO-DATE
:androidChatWidget:generateDebugAndroidTestAssets UP-TO-DATE
:androidChatWidget:mergeDebugAndroidTestAssets UP-TO-DATE
:androidChatWidget:generateDebugAndroidTestResValues UP-TO-DATE
:androidChatWidget:generateDebugAndroidTestResources UP-TO-DATE
:androidChatWidget:mergeDebugAndroidTestResources UP-TO-DATE
:androidChatWidget:processDebugAndroidTestResources UP-TO-DATE
:androidChatWidget:generateDebugAndroidTestSources UP-TO-DATE
:androidChatWidget:mockableAndroidJar UP-TO-DATE
:androidChatWidget:prepareDebugUnitTestDependencies
:androidChatWidget:compileReleaseNdk UP-TO-DATE
:androidChatWidget:copyReleaseLint UP-TO-DATE
:androidChatWidget:checkReleaseManifest
:androidChatWidget:prepareReleaseDependencies
:androidChatWidget:compileReleaseAidl UP-TO-DATE
:androidChatWidget:compileReleaseRenderscript UP-TO-DATE
:androidChatWidget:generateReleaseBuildConfig UP-TO-DATE
:androidChatWidget:mergeReleaseShaders UP-TO-DATE
:androidChatWidget:compileReleaseShaders UP-TO-DATE
:androidChatWidget:generateReleaseAssets UP-TO-DATE
:androidChatWidget:mergeReleaseAssets UP-TO-DATE
:androidChatWidget:generateReleaseResValues UP-TO-DATE
:androidChatWidget:generateReleaseResources UP-TO-DATE
:androidChatWidget:mergeReleaseResources UP-TO-DATE
:androidChatWidget:processReleaseManifest UP-TO-DATE
:androidChatWidget:processReleaseResources UP-TO-DATE
:androidChatWidget:generateReleaseSources UP-TO-DATE
:androidChatWidget:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
:androidChatWidget:compileReleaseJavaWithJavac UP-TO-DATE
:androidChatWidget:extractReleaseAnnotations UP-TO-DATE
:androidChatWidget:mergeReleaseProguardFiles UP-TO-DATE
:androidChatWidget:packageReleaseRenderscript UP-TO-DATE
:androidChatWidget:packageReleaseResources UP-TO-DATE
:androidChatWidget:processReleaseJavaRes UP-TO-DATE
:androidChatWidget:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
:androidChatWidget:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATE
:androidChatWidget:mergeReleaseJniLibFolders UP-TO-DATE
:androidChatWidget:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATE
:androidChatWidget:transformNative_libsWithSyncJniLibsForRelease UP-TO-DATE
:androidChatWidget:bundleRelease UP-TO-DATE
:app:prepareCmatAndroidAndroidChatWidgetUnspecifiedLibrary UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2340Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72340Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2340Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72340Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42340Library UP-TO-DATE
:app:prepareComAndroidSupportSupportVectorDrawable2340Library UP-TO-DATE
:app:prepareComBigkooPickerview210Library UP-TO-DATE
:app:prepareComJakewhartonButterknife801Library UP-TO-DATE
:app:prepareComTencentBuglyCrashreport2200Library UP-TO-DATE
:app:prepareIoReactivexRxandroid121Library UP-TO-DATE
:app:prepareMeIwfPhotopickerPhotoPicker085Library UP-TO-DATE
:app:prepareTopZibinLuban107Library UP-TO-DATE
:app:prepareDevDebugDependencies
:app:compileDevDebugAidl UP-TO-DATE
:app:compileDevDebugRenderscript UP-TO-DATE
:app:mergeDevDebugAssets UP-TO-DATE
:app:generateDevDebugResources UP-TO-DATE
:app:mergeDevDebugResources UP-TO-DATE
:app:processDevDebugManifest
E:\CAMT\cmat-android\app\src\main\AndroidManifest.xml:36:5-701:19 Error:
tools:replace specified at line:36 for attribute android:label|android:icon, but no new value specified
E:\CAMT\cmat-android\app\src\main\AndroidManifest.xml Error:
Validation failed, exiting
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
:app:processDevDebugManifest FAILED
Error:Execution failed for task ':app:processDevDebugManifest'.
> Manifest merger failed with multiple errors, see logs
Information:BUILD FAILED
Information:Total time: 1.806 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

解决的方法很明显,修改jar包中属性的应用和app中的一致,如果还有问题,根据相应的报错信息将gradle中对应的配置手动进行依赖,然后修改属性引用,新手刚刚开始写博客,希望大家多多支持,谢谢大家!