tools:replace =“ android:appComponentFactory错误

时间:2019-07-13 09:30:40

标签: android

当我尝试运行该应用程序时,出现以下错误。我该怎么做才能解决这个问题?

  

属性application @ appComponentFactory   值=(android.support.v4.app.CoreComponentFactory)来自   [com.android.support:support-compat:28.0.0]   AndroidManifest.xml:22:18-91也位于   [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86   值=(androidx.core.app.CoreComponentFactory)。意见建议:添加   'tools:replace =“ android:appComponentFactory”'转换为元素   在AndroidManifest.xml:9:5-31:19进行覆盖。

     

有关清单合并的更多信息,请参见...。

     

失败:构建失败,并出现异常。

     

出了什么问题:任务执行失败   ':app:processDebugManifest'。清单合并失败:属性   application @ appComponentFactory   值=(android.support.v4.app.CoreComponentFactory)来自   [com.android.support:support-compat:28.0.0]   AndroidManifest.xml:22:18-91也位于   [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86   值=(androidx.core.app.CoreComponentFactory)。意见建议:添加   'tools:replace =“ android:appComponentFactory”'转换为元素   在AndroidManifest.xml:9:5-31:19进行覆盖。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="stechome.berkeylen.firebasedatabase">
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.FLASHLIGHT"/>
    <uses-feature android:name="android.hardware.camera2" />

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


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

        </activity>

        <activity android:name=".RvActivity"/>
        <activity android:name=".QRCodeScanner"/>
        <activity android:name=".ContactActivity"/>
        <activity android:name=".RoomsActivity"/>

    </application>

</manifest>
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    defaultConfig {
        applicationId "..."
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
configurations.all {
    resolutionStrategy.force 'com.android.support:support-v4:28.0.0'
    // the above lib may be old dependencies version
}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.google.firebase:firebase-core:16.0.9'
    implementation 'com.firebaseui:firebase-ui:0.4.3'
    implementation 'com.dlazaro66.qrcodereaderview:qrcodereaderview:2.0.3'
    implementation 'com.miomin:shswiperefreshlayout:1.3.0'
    implementation 'info.hoang8f:android-segmented:1.0.6'
    implementation 'me.dm7.barcodescanner:zxing:1.9'
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0-rc01'

    implementation 'com.google.firebase:firebase-messaging:19.0.1'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-auth:17.0.0'
    compileOnly 'com.google.android.things:androidthings:0.7-devpreview'
    implementation 'com.google.firebase:firebase-database:17.0.0'
    // Required only if Facebook login support is required
    testİmplementation 'junit:junit:4.12'
    androidTestİmplementation 'com.android.support.test:runner:1.0.2'
    androidTestİmplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:mediarouter-v7:28.0.0'
}

3 个答案:

答案 0 :(得分:1)

将您的库更新为AndroidX,然后转到菜单Refactor-迁移到androidx。

答案 1 :(得分:0)

在Flutter Project中,我将该项目迁移到AndroidX,它可以正常工作。 Refactor->Migrate to AndroidX

答案 2 :(得分:0)

我正在使用颤振,就我而言,gradle升级绰绰有余

步骤:

1-打开android stodio

2-文件->打开->进入项目->选择其中的android文件夹

3-等待同步完成,这可能需要一些时间

4-您可能会在弹出窗口的右下角找到一个弹出窗口-gradle升级

5- clcik gradle升级并等待