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


当前回答

简单答案交叉检查:

您可能在manifest.xml文件中多次被定义为Same Activity。

OR

您在manifest.xml文件中定义的活动或服务或接收器不在您的项目结构中。

其他回答

打开你的gradle控制台,然后你会看到gradle建议你添加特定的行(如:tools:replace="android:allowBackup"或tools:replace="android:label"等)。将这一行添加到您的清单文件下的标签和同步gradle,就是这样。

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

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

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

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

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

在我的情况下,我在清单文件的元数据标签中使用firebase vision Dependencies上的多个模型,所以我将它们混合在一个值参数中,它确实解决了我的问题。以下是如何做到的:

<meta-data
    android:name="com.google.mlkit.vision.DEPENDENCIES"
    android:value="ocr,langid"/>

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

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

android.enableJetifier=true

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

我的案子已经解决了

build.gradle(模块:应用)

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

这个答案转到OnSignal推送通知