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


当前回答

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

Android Studio版本为3.0.1

操作系统为Windows 7

这里是截图供参考。

其他回答

我的案子已经解决了

build.gradle(模块:应用)

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

这个答案转到OnSignal推送通知

删除<activity android:name="。MainActivity"/>。正如你已经定义的那样:

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

Manifest文件显示歧义。

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

在AndroidManifest.xml: 在应用程序中,添加工具:replace="android:icon, android:theme和 在清单根目录下,添加xmlns:tools="http://schemas.android.com/tools 在build.gradle: 在根节点添加useOldManifestMerger true

如果你的项目瞄准的是Android 12,那么 在所有<activity>标签中添加<intent-filter>

android:exported="true/false"