Manifest合并失败:添加Exoplayer 2.10.5后,属性application@appComponentFactory失败。

问题描述 投票:0回答:1

在我的项目中,在我的app.gradle文件中添加Exoplayer 2.10.5后,我得到了这个错误。

我的gradle版本是3.5.2,这是我的app.gradle文件。

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

这是我的app.gradle文件。

 dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    def lifecycle_version = '1.1.1'
    implementation "android.arch.lifecycle:extensions:$lifecycle_version"
    //noinspection LifecycleAnnotationProcessorWithJava8
    annotationProcessor "android.arch.lifecycle:compiler:$lifecycle_version"
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-vector-drawable:28.0.0'
    implementation 'android.arch.persistence.room:runtime:1.1.1'
    annotationProcessor 'android.arch.persistence.room:compiler:1.1.1'
    implementation 'com.google.dagger:dagger:2.21'
    annotationProcessor 'com.google.dagger:dagger-compiler:2.21'
    implementation 'com.airbnb.android:lottie:2.7.0'
    implementation 'com.squareup.retrofit2:parent:2.5.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
    implementation 'com.squareup.retrofit2:converter-scalars:2.5.0'
    implementation 'com.github.ayalma:ExpandableRecyclerView:0.2.0'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.github.samanzamani.persiandate:PersianDate:0.7'
    implementation 'com.xw.repo:bubbleseekbar:3.20'
    implementation 'com.yydcdut:sdlv:0.7.6'
    implementation 'com.github.GrenderG:Toasty:1.4.2'
    implementation 'com.ms-square:etsyblur:0.2.1'
    implementation 'com.pes.materialcolorpicker:library:1.2.5'
    implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
    //exo player :
    //noinspection GradleDependency
    implementation "com.google.android.exoplayer:exoplayer-hls:$exoplayer_version"
    implementation "com.google.android.exoplayer:exoplayer-core:$exoplayer_version"
    implementation "com.google.android.exoplayer:exoplayer-dash:$exoplayer_version"
    implementation "com.google.android.exoplayer:exoplayer-ui:$exoplayer_version"
    //multiDex
    implementation 'com.android.support:multidex:1.0.3'
    //zoomLayout
    implementation 'com.otaliastudios:zoomlayout:1.6.1'
    //Recorder
    implementation 'com.kailashdabhi:om-recorder:1.1.0'
    implementation 'com.cleveroad:audiovisualization:1.0.0'
    implementation 'com.sdsmdg.harjot:croller:1.0.7'
    implementation 'com.github.razerdp:AnimatedPieView:1.2.4'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation project(path: ':persiancalendar')
    implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
    implementation 'com.google.firebase:firebase-core:16.0.4'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
    implementation files('libs/ksoap2-android-assembly-2.4-jar-with-dependencies.jar')
    //noinspection DuplicatePlatformClasses
    implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.11'
    }

这是我的AndroidManifest.xml文件。

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="ir.sabapp.hefzquran">
    ...
    <application
        android:name=".ui.App"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:usesCleartextTraffic="true"
        tools:ignore="GoogleAppIndexingWarning,UnusedAttribute">
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

        //activities ,services , provider
    </application>

</manifest>

当我使用 tools:replace="android:appComponentFactory" 在AndroidManifest文件的应用程序标签中得到这个错误。

 Manifest merger failed with multiple errors, see logs

问题出在哪里?

java android manifest-merging
1个回答
1
投票

Manifest合并失败:Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 is also present at [androidx.core:core:1.0.1] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory)。 建议:在AndroidManifest.xml:25:5-171:19添加'tools:replace="android:appComponentFactory"'元素来覆盖。

我的建议是--移动到 AndroidX. 您可以将现有项目迁移到 安卓X 通过选择 Refactor > 迁移到AndroidX。 从菜单栏中选择。

升级到

 classpath 'com.android.tools.build:gradle:3.6.1'//3.6.3

您的 dependencies

 implementation 'androidx.appcompat:appcompat:1.1.0'
 implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
 implementation 'androidx.legacy:legacy-support-v4:1.0.0'
© www.soinside.com 2019 - 2024. All rights reserved.