所以,我是一个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


当前回答

如果在你添加了Android库模块之后,你会得到这个错误。 你可以通过简单地从android库模块的AndroidManifest.xml中删除android:label="@string/app_name"来修复它

其他回答

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

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

}

希望这有帮助。

我的解决方案是这样的:

1-开舱单

在右上方,检查突出显示的问题,如下所示:

3 .点击红色的问题图标。这将打开问题标签如下。

4-一个一个解决

我也面临着这个错误。在构建日志中,最后一行是“编译值文件失败”。

因此,如果你面临同样的问题,那么只需在gradle中添加下面的行。属性文件很可能会修复这个问题。

android.enableJetifier=true

我的意思是它修复了Manifest合并失败的Android Studio错误。

在我的例子中,它发生在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> 

对我来说,这是可行的

在AndroidManifest.xml中查找合并错误

在AndroidManifest.xml中单击合并清单

您可以在右侧栏查看清单合并错误。这可能有助于解决这个问题。