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


当前回答

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

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. 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** There's no duplicacy like same permissions added in manifest file twice, same activity mention twice. If you have delete any activity from your project, delete it from your manifest file as well. Sometimes its because of label, icon etc tag of manifest file: a) Add the xmlns:tools line in the manifest tag. b) Add tools:replace= or tools:ignore= in the application tag.

例子:

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

如果两个依赖项的版本不同 示例:你正在使用appcompat v7 . 26.0.0和facebook com.facebook.android:facebook-android-sdk:[4,5) facebook使用com.android.support:cardview-v7 . 25.3.1版本的cardview, appcompat v7 . 26.0.0使用v7 . 26.0.0版本的cardview,因此在两个库中存在差异,因此会给出错误

错误:执行失败的任务':app:processDebugManifest'。

清单合并失败:属性元数据#android.support。VERSION@value value=(26.0.0-alpha1) from [com.android.support:appcompat-v7:26.0.0-alpha1] AndroidManifest.xml:27:9-38 [com.android.support:cardview-v7 . 25.3.1] AndroidManifest.xml:24:9-31 value=(25.3.1) 建议:在AndroidManifest.xml:25:5-27:41的元素中添加“tools:replace="android:value"”来覆盖。

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

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

其他回答

我通过删除android:replace标签解决了这个问题

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

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

这是非常简单的错误,只有当你在mainifest.xml文件中定义任何活动调用两次时才会发生

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

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



//solution:use only one 

我的解决方案是这样的:

1-开舱单

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

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

4-一个一个解决

我的案子已经解决了

build.gradle(模块:应用)

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

这个答案转到OnSignal推送通知