所以,我是一个Android和Java的初学者。我才刚刚开始学习。当我今天用Intent做实验时,我犯了一个错误。

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

我在这里找到了一些解决方案,并试图实施,但没有奏效。

这是我的身材。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'
}

这是我的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


当前回答

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

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

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

随着FirebaseUI库的最新更新,之前版本的Facebook SDK也是其中的一部分。

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

https://github.com/firebase/FirebaseUI-Android/issues/230

更新

从Android Studio 3.0及后续版本开始,app.gradle文件需要使用implementation或api而不是compile来添加应用程序的依赖项。

其他回答

在我的例子中,它显示了一个错误,因为<uses-permission>元素中有冗余。 因此,请在AndroidManifest.xml文件中检查相同的内容。

Android Studio版本为3.0.1

操作系统为Windows 7

这里是截图供参考。

我也遇到了同样的问题,我只是在我的manifest.xml中添加了一行,它为我工作了。

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

将这一行添加到

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

希望能有所帮助。

在我的例子中,它发生在Activity标记中留下一些空的intent-filter

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

我在这个问题上遇到了一个奇怪的遭遇。当重命名变量名称为user_name时,我错误地将所有名称重命名为项目的user_name。所以我的xml标签<color name:"">变成<color user_name:"">同样适用于字符串,样式,清单。但是当我检查合并的清单时,它什么也没有显示,因为我只有一个清单,没有什么要找的。

因此,检查是否有任何格式错误的xml文件。

除了可用的解决方案,还请检查这个。如果你在AndroidManifest.xml中设置了android:allowBackup="false",那么在其他依赖项中android:allowBackup="true"可能会有冲突。

解决方案 根据@CLIFFORD P Y的建议,切换到合并清单在你的AndroidManifest.xml。Android Studio将建议添加工具:replace=" Android:allowBackup"在<application />在你的AndroidManifest.xml。