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


当前回答

把这个放在你的应用模块build.gradle的末尾:

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

从这个

其他回答

对我来说,这是可行的

在AndroidManifest.xml中查找合并错误

在AndroidManifest.xml中单击合并清单

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

打开应用程序清单(AndroidManifest.xml),单击编辑窗格底部的合并清单选项卡。查看下图:

从图像中您可以看到错误在右列,尝试解决错误。它可以帮助那些有同样问题的人。点击这里阅读更多。

此外,一旦你发现了错误,如果你从你正在使用的外部库中得到错误,你必须让编译器忽略外部库中的属性。 //在manifest中的application标签中添加此属性

   tools:replace="android:allowBackup" 
                                                                                                                                          
   //Add this in the manifest tag at the top

   xmlns:tools="http://schemas.android.com/tools"

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

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

android.enableJetifier=true

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

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

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

最小sdk版本应该与您正在使用的模块/lib相同 例如:你的模块的最小sdk版本是26,你的应用程序的最小sdk版本是21。