我还有下一年级

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    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'
    implementation 'com.google.android.material:material:1.0.0-rc01'
}

但当我想要构建应用程序时,我得到下一个日志:

Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0-alpha3] AndroidManifest.xml:22:18-91
    is also present at [androidx.core:core:1.0.0-alpha3] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
    Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:5:5-19:19 to override.

好!去显化并去做:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="ru.chopcode.myapplication">

    <application
        tools:replace="android:appComponentFactory"
        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">
    </application>

</manifest>

然后我在我的Logcat中得到这个错误:

Manifest merger failed with multiple errors, see logs that I have Linked with it

当前回答

试试这个

tools:replace="android:appComponentFactory"
android:appComponentFactory="android.support.v4.app.CoreComponentFactory"

重新构建项目。

其他回答

请到Refactor->Migrate->Migrate to Android X。 请把这个加到你的gradle里。属性文件: android.enableJetifier = true android.useAndroidX = true

并执行同步。

去Refactor(图片) 单击“迁移到AndroidX”。它的工作 这是工作。

我不知道这是不是正确的答案,但这对我来说很有效

增加网格包装属性

distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

和Build Gridle to

    classpath 'com.android.tools.build:gradle:3.4.2'

它显示错误是因为版本。

只需将这两行代码添加到您的Manifest文件中

tools:replace="android:appComponentFactory"
android:appComponentFactory="whateverString"

同样的问题我已经有三天了。

这就像android希望我们要么使用Kotlin,要么使用AndroidX,他们正在抛弃android。

但我是这样解出来的。

我将项目迁移到AndroidX上。这不会带来任何与此问题相关的错误,它会分别更新文件。在应用程序中不需要更改任何方法、类或变量名。

注意:您必须使用最新的库(build。在android studio 3.4.1的最新稳定版本中