MarkWalczak
MarkWalczak

Reputation: 1571

Firebase incompatible with appcompat

I just updated gradle dependencies and now I get compile errors which I can't figure out how to manage.

Here's my gradle dependencies:

dependencies {
    implementation "android.arch.work:work-runtime:1.0.1"
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.google.firebase:firebase-core:17.0.1'
    implementation 'com.google.firebase:firebase-messaging:19.0.1'
    implementation 'com.google.android.gms:play-services-plus:17.0.0'
    implementation 'com.google.android.gms:play-services-places:17.0.0'


    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-v4:28.0.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'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

It seems like Firebase and play-service are incompatible with appcompat, but I don't know how to handle it.

There the error I get:

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

Adding 'tools:replace="android:appComponentFactory" to the manifest as suggested make things worse.

Appcompat shows this message in tooltip: Dependencies using groupId com.android.support and androidx.* can not be combined but found IdeMavenCoordinates{myGroupId='com.android.support', myArtifactId='viewpager', myVersion='28.0.0', myPacking='aar', myClassifier='null'} and IdeMavenCoordinates{myGroupId='androidx.interpolator', myArtifactId='interpolator', myVersion='1.0.0', myPacking='aar', myClassifier='null'} incompatible dependencies less... (⌘F1) Inspection info:There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion).

I need an advice how to fix the gradle dependencies please.

Upvotes: 1

Views: 643

Answers (1)

Hannan Max
Hannan Max

Reputation: 49

You will have to add two lines inside the gradle.properties file:

android.useAndroidX=true
android.enableJetifier=true

This two lines resolves dependency which are being conflicts between google's files and other third party dependencies.

OR

try to upgrade all your current dependencies.

Upvotes: 1

Related Questions