清单合并失败,在Android Studio中出现多个错误

时间:2021-02-17 19:45:22

So, I am a beginner into Android and Java. I just began learning. While I was experimenting with Intent today, I incurred an error.

所以,我是Android和Java的初学者。我只是开始学习。当我今天试验意图的时候,我犯了一个错误。

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed with multiple errors, see logs

I found some solutions here and tried to implement them, but it did not work.

我在这里找到了一些解决方案,并试图实现它们,但它不起作用。

This is my build.gradle :

这是我的建立。gradle:

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'
}

This is my AndroidManifest :

这是我的雄激素清单:

<?xml version="1.0" encoding="utf-8"?>

package="com.example.rohan.petadoptionthing" >

<application

    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <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>

    <activity android:name=".Second"
        />

    <activity android:name=".third"/>
    <activity android:name=".MainActivity"/>


</application>

This is my first week with coding, I am sorry if this is a really silly thing. I am really new to this and did not find any other place to ask. Sorry if I broke any rules

这是我写代码的第一周,如果这真的很傻的话,我很抱歉。我对这事真的很陌生,也找不到别的地方可问。对不起,如果我违反了任何规则

18 个解决方案

#1


78  

Remove <activity android:name=".MainActivity"/> from your mainfest file. As you have already defined it as:

删除 <活动android:name = "。主活动“ />来自您的主节文件。如你已将其定义为:

 <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>

So, Manifest file showing ambiguity.

因此,清单文件显示不明确。

#2


310  

Open application manifest(AndroidManifest.xml) ,click on Merged Manifest.Check image

打开应用程序清单(AndroidManifest.xml),单击合并的清单。检查图像

清单合并失败,在Android Studio中出现多个错误

You can view error in right colum ,try to solve the error.It may help some one with same problem.

你可以在右上角查看错误,尝试解决错误。这可能对有同样问题的人有所帮助。

#3


48  

I was also facing same issues, and after lot of research found the solution:

我也面临着同样的问题,经过大量的研究,我找到了解决方案:

  1. Your min sdk version should be same as of the modules you are using eg: your module min sdk version is 14 and your app min sdk version is 9 It should be same.
  2. 你的最小sdk版本应该和你使用的模块相同例如:你的模块最小sdk版本是14,你的app最小sdk版本是9,应该是一样的。
  3. If build version of your app and modules not same. Again it should same ** In short, your app build.gradle file and manifest should have same configurations**
  4. 如果你的应用和模块的构建版本不一样。同样,你的应用程序也应该是相同的。等级文件和清单应该具有相同的配置**
  5. There's no duplicacy like same permissions added in manifest file twice, same activity mention twice.
  6. 在清单文件中没有重复相同的权限,相同的活动提到两次。
  7. If you have delete any activity from your project, delete it from your manifest file as well.
  8. 如果您已经从项目中删除了任何活动,那么也要从清单文件中删除它。
  9. Sometimes its because of label, icon etc tag of manifest file:
  10. 有时是因为清单文件的标签、图标等标签:

a) Add the xmlns:tools line in the manifest tag.

a)在manifest标记中添加xmlns:tools行。

b) Add tools:replace= or tools:ignore= in the application tag.

b)在应用程序标记中添加工具:replace=或tools:ignore=。

Example:

例子:

<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>
  1. If two dependencies are of not same version example: you are using dependency for appcompat v7:26.0.0 and for facebook com.facebook.android:facebook-android-sdk:[4,5) facebook uses cardview of version com.android.support:cardview-v7:25.3.1 and appcompat v7:26.0.0 uses cardview of version v7:26.0.0, So there is discripancy in two libraries and thus give error
  2. 如果两个依赖项是不相同的版本示例:您正在对appcompat v7:26.0.0和facebook com.facebook.android .android: [4,5] facebook使用card - view of version com.android.support:cardview-v7:25.3.1和appcompat v7:26.0.0使用cardview of version v7:26.0.0中的cardview,因此有两个错误

Error:Execution failed for task ':app:processDebugManifest'.

错误:任务“:app:processDebugManifest”执行失败。

Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.0.0-alpha1) from [com.android.support:appcompat-v7:26.0.0-alpha1] AndroidManifest.xml:27:9-38 is also present at [com.android.support:cardview-v7:25.3.1] AndroidManifest.xml:24:9-31 value=(25.3.1). Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:25:5-27:41 to override.

清单合并失败:属性元数据#android.support。VERSION@value =(26.0 -alpha1)来自[com.android.support:appcompat-v7:26.0 -alpha1] AndroidManifest。xml:27:9-38也出现在[com. androidis .support:cardview-v7:25.3.1] AndroidManifest。xml:24:9-31价值=(25.3.1)。建议:在AndroidManifest中添加“工具:replace=”=“android:value”。xml:25:5-27:41覆盖。

So by using appcompat of version 25.3.1, We can avoid this error

因此,通过使用版本25.3.1的appcompat,我们可以避免这个错误

By considering above points in mind, you will get rid of this irritating issue. You can check my blog too https://wordpress.com/post/dhingrakimmi.wordpress.com/23

通过考虑以上几点,你将摆脱这个恼人的问题。你也可以查看我的博客https://wordpress.com/post/dhingrakimmi.wordpress.com/23

#4


8  

In addition to available solutions, please check this also.
If you have set android:allowBackup="false" in your AndroidManifest.xml then there may be a conflict for android:allowBackup="true" in other dependencies.

除了可用的解决方案之外,请也检查一下。如果您在AndroidManifest中设置了android:allowBackup="false"。那么,在其他依赖项中,android:allowBackup="true"可能会有冲突。

Solution
As suggested by @CLIFFORD P Y, switch to Merged Manifest in your AndroidManifest.xml. Android Studio will suggest to add tools:replace="android:allowBackup" in <application /> in your AndroidManifest.xml.

通过@CLIFFORD py建议的解决方案,切换到AndroidManifest.xml中的合并清单。Android Studio将建议添加工具:在你的AndroidManifest.xml中,在 中,替换=" Android:allowBackup"。

#5


5  

Usually occurs when you have errors in your manifest.Open AndroidManifest.xml .Click on the merged manifest tab.The errors can be seen there .Also include suggestions mentioned there.When I had a similar problem while importing com.google.android.gms.maps.model.LatLng ,it suggested me to include tools:overrideLibrary="com.google.android.gms.maps" in the application tag and the build was successful.

通常发生在您的清单中有错误时。AndroidManifest开放。单击合并的manifest选项卡。错误可以在那里看到。也包括在那里提到的建议。当我在导入com.google.android.gms.maps.model时遇到了类似的问题。LatLng建议我加入工具:overrideLibrary="com.google.android.gms "。在应用程序标签和构建中映射是成功的。

#6


5  

I was facing the same problem and I've just added one line in my manifest.xml and it worked for me.

我遇到了同样的问题,我刚刚在我的舱单上加了一行。xml对我很有用。

tools:replace="android:allowBackup,icon,theme,label,name"> 

add this line under

下添加这一行

<application
    android:name=".MyApplication"
    android:allowBackup="true"
    android:icon="@drawable/launcher"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:screenOrientation="portrait"
    android:supportsRtl="true"
    android:theme="@style/AppThemecustom"
    tools:replace="android:allowBackup,icon,theme,label">

Hope it will help.

希望它会有所帮助。

#7


3  

In my case it was showing an error because there was a redundancy in <uses-permission> element. So, please check in your AndroidManifest.xml file for the same.

在我的例子中,它显示了一个错误,因为在 元素中存在冗余。所以,请检查一下你的安卓系统。同样的xml文件。

Android Studio version is 3.0.1

Android Studio版本是3.0.1

Operating System is Windows 7

操作系统是Windows 7

Here is the screenshot for reference.

这是截屏以供参考。

清单合并失败,在Android Studio中出现多个错误

#8


2  

My case i have fixed it by

我的箱子已经修好了

build.gradle(Module:app)

build.gradle(模块:应用)

defaultConfig {
----------
multiDexEnabled true
}
dependencies {
    ...........
    implementation 'com.google.android.gms:play-services-gcm:11.0.2'
    implementation 'com.onesignal:OneSignal:3.+@aar'
    }

This answer releted to OnSignal push notification

这个答案与OnSignal push通知相关

#9


1  

for the past few days I was also going through the same issue. But after, a lot of research I finally found a solution for this.
In order to solve this issue, what you need to do is:
1. Check if your project's build.gradle file and the module's build.gradle file contain same versions of all dependencies.
2. Make sure, your project's compileSdkVersion, buildToolsVersion, minSdkVersion and targetSdkVersion matches the one in the modules or libraries that you have added into the project.

在过去的几天里,我也遇到了同样的问题。但经过大量研究,我终于找到了解决办法。为了解决这个问题,你需要做的是:1。检查项目的构建。分级文件和模块的构建。渐变文件包含所有依赖项的相同版本。2。确保您的项目的编译dkversion、buildToolsVersion、minSdkVersion和targetSdkVersion与您添加到项目中的模块或库中的模块或库中的版本匹配。

compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
    applicationId "com.example.appname"
    minSdkVersion 16
    targetSdkVersion 25
    versionCode 22
    versionName "2.0.3"

}

Hope, this helps.

希望,这可以帮助。

#10


1  

If after you add a Android Library Module and you get this error.
You can fix it by simple remove the android:label="@string/app_name" from the AndroidManifest.xml of your Android Library Module

如果你添加了一个Android库模块,你会得到这个错误。您可以通过从AndroidManifest中删除android:label=“@string/app_name”来修复它。Android库模块的xml

#11


1  

  1. In AndroidManifest.xml:

    在AndroidManifest.xml:

    • At application, add tools:replace="android:icon, android:theme and
    • 在应用中,添加工具:replace="android:icon "、"android: theme "和
    • At the Manifest root, add xmlns:tools="http://schemas.android.com/tools
    • 在Manifest根目录中,添加xmlns:tools="http://schemas.android.com/tools "
  2. In build.gradle:

    在build.gradle:

    • At root, add useOldManifestMerger true
    • 在根目录中,添加useoldmanifest merge true

#12


0  

As a newbie to Android Studio, in my case, I had moved an existing project from Eclipse to Android Studio and found that there was a duplicate definition of an activity within my Manifest.xml that hadn't been picked up by Eclipse was shown as a Gradle error.

作为Android Studio的新手,在我的例子中,我将一个现有的项目从Eclipse移动到Android Studio,发现在我的Manifest中有一个活动的重复定义。未被Eclipse拾取的xml显示为一个渐变错误。

I found this by going to the Gradle Console (bottom right of the screen).

我找到了这个,通过进入Gradle控制台(屏幕右下角)。

#13


0  

Happened with me twice when I refractor (Rename with SHIFT + F6) the name of a field in our files and it asks you to change it everywhere and we without paying attention change the name everywhere. For example, if you have a variable name "id" in your Java class and you rename it with SHIFT + F6. If you don't pay attention to the next dialog which will ask you wherever else it is going to change the id and you tick check all it will change all the id in your layout files from the new value.

当我重命名(用SHIFT + F6重命名)我们文件中的一个字段的名称时发生过两次,它要求您在任何地方修改它,而我们却没有注意到在任何地方修改它的名称。例如,如果在Java类中有一个变量名“id”,并使用SHIFT + F6重命名它。如果你不注意下一个对话框它会问你其他地方它会改变id你勾选所有它会改变你布局文件中的所有id从新的值。

#14


0  

this is very simple error only occur when you define any activity call two time in mainifest.xml file Example like

这是一个非常简单的错误,只有当您在mainifest中定义任何活动调用两次时才会发生。xml文件的例子如

<activity android:name="com.futuretech.mpboardexam.Game" ></activity>

//and launcher also------like that



//solution:use only one 

#15


0  

I was using the FirebaseUI Library along with the Facebook SDK Library, which was causing me the issue.

我正在使用FirebaseUI库和Facebook SDK库,这导致了我的问题。

compile 'com.firebaseui:firebase-ui-database:0.4.4'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'

And from here, I got rid of this issue.

从这里,我摆脱了这个问题。

With the latest update of FirebaseUI library, previous version of Facebook SDK is also a part of it.

随着FirebaseUI库的最新更新,以前版本的Facebook SDK也在其中。

If you are using the both the libraries, please remove the Facebook SDK Library.

如果您正在使用这两个库,请删除Facebook SDK库。

#16


0  

Open your gradle console, then you see gradle suggest you to add the particular line (Like: tools:replace="android:allowBackup" or tools:replace="android:label" etc). Add that line into your manifest file under tag and sync gradle, that's it.

打开渐变控制台,你会看到渐变建议你添加特定的行(比如:tools:replace=“android:allowBackup”或tools:replace=“android:label”等)。将这一行添加到标签和同步渐变下的manifest文件中,就是这样。

#17


0  

Put this at the end of your app module build.gradle:

把这个放在app模块的最后。

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'
        }
    }
}}

from this

从这个

#18


0  

Supplement the answer Phan Van Linh. I deleted these lines:

补充一下范文林的答案。我删除这些行:

  android:icon="@mipmap/ic_launcher"
  android:label="name"

#1


78  

Remove <activity android:name=".MainActivity"/> from your mainfest file. As you have already defined it as:

删除 <活动android:name = "。主活动“ />来自您的主节文件。如你已将其定义为:

 <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>

So, Manifest file showing ambiguity.

因此,清单文件显示不明确。

#2


310  

Open application manifest(AndroidManifest.xml) ,click on Merged Manifest.Check image

打开应用程序清单(AndroidManifest.xml),单击合并的清单。检查图像

清单合并失败,在Android Studio中出现多个错误

You can view error in right colum ,try to solve the error.It may help some one with same problem.

你可以在右上角查看错误,尝试解决错误。这可能对有同样问题的人有所帮助。

#3


48  

I was also facing same issues, and after lot of research found the solution:

我也面临着同样的问题,经过大量的研究,我找到了解决方案:

  1. Your min sdk version should be same as of the modules you are using eg: your module min sdk version is 14 and your app min sdk version is 9 It should be same.
  2. 你的最小sdk版本应该和你使用的模块相同例如:你的模块最小sdk版本是14,你的app最小sdk版本是9,应该是一样的。
  3. If build version of your app and modules not same. Again it should same ** In short, your app build.gradle file and manifest should have same configurations**
  4. 如果你的应用和模块的构建版本不一样。同样,你的应用程序也应该是相同的。等级文件和清单应该具有相同的配置**
  5. There's no duplicacy like same permissions added in manifest file twice, same activity mention twice.
  6. 在清单文件中没有重复相同的权限,相同的活动提到两次。
  7. If you have delete any activity from your project, delete it from your manifest file as well.
  8. 如果您已经从项目中删除了任何活动,那么也要从清单文件中删除它。
  9. Sometimes its because of label, icon etc tag of manifest file:
  10. 有时是因为清单文件的标签、图标等标签:

a) Add the xmlns:tools line in the manifest tag.

a)在manifest标记中添加xmlns:tools行。

b) Add tools:replace= or tools:ignore= in the application tag.

b)在应用程序标记中添加工具:replace=或tools:ignore=。

Example:

例子:

<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>
  1. If two dependencies are of not same version example: you are using dependency for appcompat v7:26.0.0 and for facebook com.facebook.android:facebook-android-sdk:[4,5) facebook uses cardview of version com.android.support:cardview-v7:25.3.1 and appcompat v7:26.0.0 uses cardview of version v7:26.0.0, So there is discripancy in two libraries and thus give error
  2. 如果两个依赖项是不相同的版本示例:您正在对appcompat v7:26.0.0和facebook com.facebook.android .android: [4,5] facebook使用card - view of version com.android.support:cardview-v7:25.3.1和appcompat v7:26.0.0使用cardview of version v7:26.0.0中的cardview,因此有两个错误

Error:Execution failed for task ':app:processDebugManifest'.

错误:任务“:app:processDebugManifest”执行失败。

Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.0.0-alpha1) from [com.android.support:appcompat-v7:26.0.0-alpha1] AndroidManifest.xml:27:9-38 is also present at [com.android.support:cardview-v7:25.3.1] AndroidManifest.xml:24:9-31 value=(25.3.1). Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:25:5-27:41 to override.

清单合并失败:属性元数据#android.support。VERSION@value =(26.0 -alpha1)来自[com.android.support:appcompat-v7:26.0 -alpha1] AndroidManifest。xml:27:9-38也出现在[com. androidis .support:cardview-v7:25.3.1] AndroidManifest。xml:24:9-31价值=(25.3.1)。建议:在AndroidManifest中添加“工具:replace=”=“android:value”。xml:25:5-27:41覆盖。

So by using appcompat of version 25.3.1, We can avoid this error

因此,通过使用版本25.3.1的appcompat,我们可以避免这个错误

By considering above points in mind, you will get rid of this irritating issue. You can check my blog too https://wordpress.com/post/dhingrakimmi.wordpress.com/23

通过考虑以上几点,你将摆脱这个恼人的问题。你也可以查看我的博客https://wordpress.com/post/dhingrakimmi.wordpress.com/23

#4


8  

In addition to available solutions, please check this also.
If you have set android:allowBackup="false" in your AndroidManifest.xml then there may be a conflict for android:allowBackup="true" in other dependencies.

除了可用的解决方案之外,请也检查一下。如果您在AndroidManifest中设置了android:allowBackup="false"。那么,在其他依赖项中,android:allowBackup="true"可能会有冲突。

Solution
As suggested by @CLIFFORD P Y, switch to Merged Manifest in your AndroidManifest.xml. Android Studio will suggest to add tools:replace="android:allowBackup" in <application /> in your AndroidManifest.xml.

通过@CLIFFORD py建议的解决方案,切换到AndroidManifest.xml中的合并清单。Android Studio将建议添加工具:在你的AndroidManifest.xml中,在 中,替换=" Android:allowBackup"。

#5


5  

Usually occurs when you have errors in your manifest.Open AndroidManifest.xml .Click on the merged manifest tab.The errors can be seen there .Also include suggestions mentioned there.When I had a similar problem while importing com.google.android.gms.maps.model.LatLng ,it suggested me to include tools:overrideLibrary="com.google.android.gms.maps" in the application tag and the build was successful.

通常发生在您的清单中有错误时。AndroidManifest开放。单击合并的manifest选项卡。错误可以在那里看到。也包括在那里提到的建议。当我在导入com.google.android.gms.maps.model时遇到了类似的问题。LatLng建议我加入工具:overrideLibrary="com.google.android.gms "。在应用程序标签和构建中映射是成功的。

#6


5  

I was facing the same problem and I've just added one line in my manifest.xml and it worked for me.

我遇到了同样的问题,我刚刚在我的舱单上加了一行。xml对我很有用。

tools:replace="android:allowBackup,icon,theme,label,name"> 

add this line under

下添加这一行

<application
    android:name=".MyApplication"
    android:allowBackup="true"
    android:icon="@drawable/launcher"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:screenOrientation="portrait"
    android:supportsRtl="true"
    android:theme="@style/AppThemecustom"
    tools:replace="android:allowBackup,icon,theme,label">

Hope it will help.

希望它会有所帮助。

#7


3  

In my case it was showing an error because there was a redundancy in <uses-permission> element. So, please check in your AndroidManifest.xml file for the same.

在我的例子中,它显示了一个错误,因为在 元素中存在冗余。所以,请检查一下你的安卓系统。同样的xml文件。

Android Studio version is 3.0.1

Android Studio版本是3.0.1

Operating System is Windows 7

操作系统是Windows 7

Here is the screenshot for reference.

这是截屏以供参考。

清单合并失败,在Android Studio中出现多个错误

#8


2  

My case i have fixed it by

我的箱子已经修好了

build.gradle(Module:app)

build.gradle(模块:应用)

defaultConfig {
----------
multiDexEnabled true
}
dependencies {
    ...........
    implementation 'com.google.android.gms:play-services-gcm:11.0.2'
    implementation 'com.onesignal:OneSignal:3.+@aar'
    }

This answer releted to OnSignal push notification

这个答案与OnSignal push通知相关

#9


1  

for the past few days I was also going through the same issue. But after, a lot of research I finally found a solution for this.
In order to solve this issue, what you need to do is:
1. Check if your project's build.gradle file and the module's build.gradle file contain same versions of all dependencies.
2. Make sure, your project's compileSdkVersion, buildToolsVersion, minSdkVersion and targetSdkVersion matches the one in the modules or libraries that you have added into the project.

在过去的几天里,我也遇到了同样的问题。但经过大量研究,我终于找到了解决办法。为了解决这个问题,你需要做的是:1。检查项目的构建。分级文件和模块的构建。渐变文件包含所有依赖项的相同版本。2。确保您的项目的编译dkversion、buildToolsVersion、minSdkVersion和targetSdkVersion与您添加到项目中的模块或库中的模块或库中的版本匹配。

compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
    applicationId "com.example.appname"
    minSdkVersion 16
    targetSdkVersion 25
    versionCode 22
    versionName "2.0.3"

}

Hope, this helps.

希望,这可以帮助。

#10


1  

If after you add a Android Library Module and you get this error.
You can fix it by simple remove the android:label="@string/app_name" from the AndroidManifest.xml of your Android Library Module

如果你添加了一个Android库模块,你会得到这个错误。您可以通过从AndroidManifest中删除android:label=“@string/app_name”来修复它。Android库模块的xml

#11


1  

  1. In AndroidManifest.xml:

    在AndroidManifest.xml:

    • At application, add tools:replace="android:icon, android:theme and
    • 在应用中,添加工具:replace="android:icon "、"android: theme "和
    • At the Manifest root, add xmlns:tools="http://schemas.android.com/tools
    • 在Manifest根目录中,添加xmlns:tools="http://schemas.android.com/tools "
  2. In build.gradle:

    在build.gradle:

    • At root, add useOldManifestMerger true
    • 在根目录中,添加useoldmanifest merge true

#12


0  

As a newbie to Android Studio, in my case, I had moved an existing project from Eclipse to Android Studio and found that there was a duplicate definition of an activity within my Manifest.xml that hadn't been picked up by Eclipse was shown as a Gradle error.

作为Android Studio的新手,在我的例子中,我将一个现有的项目从Eclipse移动到Android Studio,发现在我的Manifest中有一个活动的重复定义。未被Eclipse拾取的xml显示为一个渐变错误。

I found this by going to the Gradle Console (bottom right of the screen).

我找到了这个,通过进入Gradle控制台(屏幕右下角)。

#13


0  

Happened with me twice when I refractor (Rename with SHIFT + F6) the name of a field in our files and it asks you to change it everywhere and we without paying attention change the name everywhere. For example, if you have a variable name "id" in your Java class and you rename it with SHIFT + F6. If you don't pay attention to the next dialog which will ask you wherever else it is going to change the id and you tick check all it will change all the id in your layout files from the new value.

当我重命名(用SHIFT + F6重命名)我们文件中的一个字段的名称时发生过两次,它要求您在任何地方修改它,而我们却没有注意到在任何地方修改它的名称。例如,如果在Java类中有一个变量名“id”,并使用SHIFT + F6重命名它。如果你不注意下一个对话框它会问你其他地方它会改变id你勾选所有它会改变你布局文件中的所有id从新的值。

#14


0  

this is very simple error only occur when you define any activity call two time in mainifest.xml file Example like

这是一个非常简单的错误,只有当您在mainifest中定义任何活动调用两次时才会发生。xml文件的例子如

<activity android:name="com.futuretech.mpboardexam.Game" ></activity>

//and launcher also------like that



//solution:use only one 

#15


0  

I was using the FirebaseUI Library along with the Facebook SDK Library, which was causing me the issue.

我正在使用FirebaseUI库和Facebook SDK库,这导致了我的问题。

compile 'com.firebaseui:firebase-ui-database:0.4.4'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'

And from here, I got rid of this issue.

从这里,我摆脱了这个问题。

With the latest update of FirebaseUI library, previous version of Facebook SDK is also a part of it.

随着FirebaseUI库的最新更新,以前版本的Facebook SDK也在其中。

If you are using the both the libraries, please remove the Facebook SDK Library.

如果您正在使用这两个库,请删除Facebook SDK库。

#16


0  

Open your gradle console, then you see gradle suggest you to add the particular line (Like: tools:replace="android:allowBackup" or tools:replace="android:label" etc). Add that line into your manifest file under tag and sync gradle, that's it.

打开渐变控制台,你会看到渐变建议你添加特定的行(比如:tools:replace=“android:allowBackup”或tools:replace=“android:label”等)。将这一行添加到标签和同步渐变下的manifest文件中,就是这样。

#17


0  

Put this at the end of your app module build.gradle:

把这个放在app模块的最后。

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'
        }
    }
}}

from this

从这个

#18


0  

Supplement the answer Phan Van Linh. I deleted these lines:

补充一下范文林的答案。我删除这些行:

  android:icon="@mipmap/ic_launcher"
  android:label="name"