清单合并失败,Android Studio中出现多个错误
所以,我是Android和Java的初学者。我刚开始学习。当我今天尝试意图时,我犯了一个错误清单合并失败,Android Studio中出现多个错误,android,xml,Android,Xml,所以,我是Android和Java的初学者。我刚开始学习。当我今天尝试意图时,我犯了一个错误 Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed with multiple errors, see logs 我在这里找到了一些解决方案并尝试实施,但没有成功 这是我的身材。格雷德尔: apply plugin: 'com.android.application' and
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed with multiple errors, see logs
我在这里找到了一些解决方案并尝试实施,但没有成功
这是我的身材。格雷德尔:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.example.rohan.petadoptionthing"
minSdkVersion 10
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
}
这是我的AndroidManifest:
<?xml version="1.0" encoding="utf-8"?>
package=“com.example.rohan.petadoptionthing”>
这是我写代码的第一周,如果这真的是一件愚蠢的事情,我很抱歉。我真的是个新手,没有找到其他地方可以问。对不起,如果我违反了任何规则,请从您的mainfest文件中删除
。正如您已经将其定义为:
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
因此,清单文件显示了模糊性。我也面临同样的问题,经过大量研究,找到了解决方案:
build.gradle
文件和清单应该具有相同的配置**xmlns:tools
行
b) 在应用程序标记中添加tools:replace=
或tools:ignore=
例如:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.slinfy.ikharelimiteduk"
xmlns:tools="http://schemas.android.com/tools"
android:versionCode="1"
android:versionName="1.0" >
<application
tools:replace="icon, label"
android:label="myApp"
android:name="com.example.MyApplication"
android:allowBackup="true"
android:hardwareAccelerated="false"
android:icon="@drawable/ic_launcher"
android:theme="@style/Theme.AppCompat" >
</application>
</manifest>
作为Android Studio的新手,在我的例子中,我将一个现有项目从Eclipse移动到了Android Studio,并发现在我的Manifest.xml中有一个重复的活动定义,而Eclipse没有获取该定义,它显示为渐变错误
我是通过进入Gradle控制台(屏幕右下角)找到的。打开应用程序清单(AndroidManifest.xml
),然后单击编辑窗格底部的合并清单
选项卡。查看下图:
从图像中,您可以看到右侧列中的错误,请尝试解决该错误。它可能会帮助有同样问题的人。阅读更多
此外,一旦您发现错误,并且如果您从正在使用的外部库中获得该错误,则必须让编译器忽略外部库中的属性。
//在清单中的应用程序标记中添加此属性
tools:replace="android:allowBackup"
//Add this in the manifest tag at the top
xmlns:tools="http://schemas.android.com/tools"
除了可用的解决方案外,还请检查此项。
如果您在AndroidManifest.xml
中设置了android:allowBackup=“false”
,则其他依赖项中的android:allowBackup=“true”
可能存在冲突
解决方案
按照@CLIFFORD py的建议,在AndroidManifest.xml
中切换到Merged Manifest
。Android Studio将建议在您的AndroidManifest.xml
中添加tools:replace=“Android:allowBackup”
,我遇到了同样的问题,我刚刚在manifest.xml中添加了一行,这对我来说很有效
tools:replace="android:allowBackup,icon,theme,label,name">
将这一行添加到下面
希望这会有帮助
在AndroidManifest.xml
中:
- 在应用程序中,添加
tools:replace=“android:icon,android:theme
和
- 在清单根目录下,添加
xmlns:tools=”http://schemas.android.com/tools
在build.gradle
中:
- 在根目录下,添加
useoldmanifestmerge true
在过去的几天里,我也经历了同样的问题。但经过大量研究,我终于找到了解决办法。
为了解决此问题,您需要做的是:
一,。检查项目的build.gradle文件和模块的build.gradle文件是否包含所有依赖项的相同版本。
二,。确保项目的编译dkversion、构建工具版本、minSdkVersion和targetSdkVersion与添加到项目中的模块或库中的版本匹配
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.example.appname"
minSdkVersion 16
targetSdkVersion 25
versionCode 22
versionName "2.0.3"
}
希望,这会有所帮助。如果在添加Android库模块后出现此错误。
您只需从android库模块的android manifest.xml
中删除android:label=“@string/app\u name”
,即可修复此问题在我使用折射器时发生两次(使用SHIFT+F6重命名)文件中某个字段的名称,它要求您在任何地方更改它,而我们在不注意的情况下在任何地方更改名称。
例如,如果Java类中有一个变量名“id”,并使用SHIFT+F6对其进行重命名。如果您不注意下一个对话框,该对话框将询问您它将在何处更改id,您勾选“全部检查”,它将从新值更改布局文件中的所有id。通常在清单中出现错误时发生。打开AndroidManifest.xml。单击“合并清单”选项卡。可以在那里看到错误。还包括此处提到的建议。当我在导入com.google.android.gms.maps.model.LatLng时遇到类似问题时,它建议我包括工具:overrideLibrary=“com.google.android.gms.maps”这是一个非常简单的错误,只有在mainifest.xml文件中定义任何活动调用两次时才会发生,例如
<activity android:name="com.futuretech.mpboardexam.Game" ></activity>
//and launcher also------like that
//solution:use only one
//发射装置也是这样的
//解决方案:只使用一个
我正在使用FirebaseUI库
以及Facebook SDK库
,而
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.example.appname"
minSdkVersion 16
targetSdkVersion 25
versionCode 22
versionName "2.0.3"
}
<activity android:name="com.futuretech.mpboardexam.Game" ></activity>
//and launcher also------like that
//solution:use only one
implementation 'com.firebaseui:firebase-ui-database:0.4.4'
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
defaultConfig {
----------
multiDexEnabled true
}
dependencies {
...........
implementation 'com.google.android.gms:play-services-gcm:11.0.2'
implementation 'com.onesignal:OneSignal:3.+@aar'
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.0'
}
}
}}
android:icon="@mipmap/ic_launcher"
android:label="name"
<application
tools:node="replace">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
</activity>
android:allowBackup="true"
android {
...
defaultConfig {
manifestPlaceholders = [myKey1: "myValue1"]
manifestPlaceholders = [myKey2: "myValue2"] // Error!
}
}
android {
...
defaultConfig {
manifestPlaceholders = [myKey1: "myValue1", myKey2: "myValue2"]
}
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.test">