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


当前回答

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

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

其他回答

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

在看到CLIFFORD的回答看到错误后,帮助我解决这个问题的是在intent-filter动作标签中将“android:namex”重命名为“android:name”。以防同样的解决方案能帮助到其他人。

    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:namex="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

检查清单中是否声明了任何重复的活动。这是我的错误,这个错误和问题解决后,删除副本。

对于你们所有人都有同样的问题,但当你合并清单时,没有任何错误,这个解决方案为我工作,没有编辑你的“清单”文件和改变任何配置,删除这个,删除那个等。

打开“设置”。gradle”文件。 添加代码“gradlePluginPortal()”。

如果你开始一个新项目,如果你使用更新的Android Studio,代码可能会自动出现,但你需要再添加一次,如下所示: pluginManagement { 存储库{ gradlePluginPortal () 谷歌() mavenCentral () jcenter () Maven {url 'https://jitpack.io'} }

并再次输入代码“gridlePluginCentral()”。

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        jcenter()
        maven {url 'https://jitpack.io'}
        gradlePluginPortal()
    }
}

在我的案例中,这样的问题通常发生在我们使用github用户库并将其用于布局文件或作为java文件中的“导入”时。让你的Android Studio保持最新状态并保留旧版本总是一个好主意,因为通常会对配置、库和其他支持文件进行更改。最好避免使用来自github用户的库,最好使用来自谷歌的库。

这是因为您正在使用新的材料库和遗留的支持库。

你必须迁移android。为了使用com.google.android.material,支持androidx。

如果你使用的是android studio v 3.2或更高版本,简单

去refactor——>迁移到ANDROID X。

一定要备份你的项目。