清单合并失败并出现多个错误,请参阅Android Studio上的日志

时间:2019-04-02 13:23:39

标签: java android build.gradle android-manifest

该错误表示“错误:任务':app:processDebugManifest'的执行失败。>“ 我已经在该网站上尝试了许多解决方案,但是仍然无法解决问题。请帮助我

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="project.myapp">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        tools:replace="android:appComponentFactory">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

build.gradle(Module:app)

apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "project.myapp"
        minSdkVersion 21
        targetSdkVersion 28
        multiDexEnabled true
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
//    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.google.firebase:firebase-database:11.0.4'
    implementation 'com.google.firebase:firebase-auth:11.0.4'
    implementation 'com.google.firebase:firebase-storage:11.0.4'
    implementation 'com.firebaseui:firebase-ui-firestore:3.0.0'
    implementation 'de.hdodenhof:circleimageview:2.0.0'
    implementation 'com.github.bumptech.glide:glide:3.7.0'
    implementation 'com.jakewharton:butterknife:10.1.0'
    annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

apply plugin: 'com.google.gms.google-services'

build.gradle(Project:myapp)

buildscript {

    repositories {
        google()
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.1.0'
        classpath 'com.jakewharton:butterknife-gradle-plugin:8.5.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

在合并清单上说

  

合并错误:错误:在属性的第5行指定的tools:replaces   android:appComponentFactory,但未指定新值app main   清单(此文件),第4行错误:验证失败,正在退出应用   主清单(此文件)

5 个答案:

答案 0 :(得分:1)

删除

  • tools:ignore =“ GoogleAppIndexingWarning”,
  • tools:replace =“ android:appComponentFactory”

修复这个问题。祝您好运:)

答案 1 :(得分:1)

对我来说,解决方案是只迁移到androidx,在android studio上转到: 重构>迁移到AndroidX 清理项目。

答案 2 :(得分:1)

只需删除以下行:

tools:replace="android:appComponentFactory"

重新编译,最后对我有用!

答案 3 :(得分:0)

您应该尝试以下操作:

1:删除工具:replace =“ android:appComponentFactory”

2:为android:appComponentFactory“属性提供新值

来自: Manifest merger failed, error on compiling

对我有用!

答案 4 :(得分:0)

解决我的问题

重构 > 迁移到 AndroidX