12

I want to upgrade Google libraries:

build.gradle (app):

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}"
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1'
    // Here an error appears.
    implementation "com.android.support:appcompat-v7:${supportLibraryVersion}"
    implementation "com.android.support:support-v4:${supportLibraryVersion}"
    implementation "com.android.support:design:${supportLibraryVersion}"
    implementation "com.android.support:support-vector-drawable:${supportLibraryVersion}"
    implementation "com.android.support:recyclerview-v7:${supportLibraryVersion}"
    implementation "com.android.support:appcompat-v7:${supportLibraryVersion}"
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation "com.android.support:support-compat:${supportLibraryVersion}"

    // These libraries are updated.

    // Google Maps.
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.google.android.gms:play-services-location:17.0.0'

    implementation "com.google.firebase:firebase-messaging:19.0.1"
    implementation "com.google.android.gms:play-services-base:17.0.0"

    // Firebase.
    implementation 'com.google.firebase:firebase-config:18.0.0'
    implementation 'com.google.firebase:firebase-core:17.0.0'

    // Multidex.
    implementation 'com.android.support:multidex:1.0.3'
}

build.gradle (project):

buildscript {
    ext.compile_sdk_version = 29
    ext.min_sdk_version = 16
    ext.target_sdk_version = 29
    ext.kotlin_version = '1.3.40'
    ext.supportLibraryVersion = "28.0.0"

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // Firebase.
        classpath 'com.google.gms:google-services:4.2.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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

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

I get an error in the first support library. I don't have AndroidX, only 28.0.0. Updating any of Google libraries will lead to this error (Google Maps or Firebase).

Dependencies using groupId com.android.support and androidx.* can not be combined but found IdeMavenCoordinates{myGroupId='com.android.support', myArtifactId='loader', myVersion='28.0.0', myPacking='aar', myClassifier='null'} and IdeMavenCoordinates{myGroupId='androidx.versionedparcelable', myArtifactId='versionedparcelable', myVersion='1.0.0', myPacking='aar', myClassifier='null'} incompatible dependencies

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). Issue id: GradleCompatible

I saw Can I use library that used android support with Androidx projects., having problem and errors with dependencies, https://github.com/react-native-community/async-storage/issues/128.

After compiling the project I receive in "Build Output" in line android:supportsRtl="true":

Task :app:processDebugManifest FAILED

C:\Users\ ...\AndroidStudioProjects\ ...\app\src\main\AndroidManifest.xml:22:18-91 Error: 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.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:15:5-145:19 to override.

When I add to <application> tag in AndroidManifest tools:replace="android:appComponentFactory" I receive another error:

tools:replace specified at line:15 for attribute android:appComponentFactory, but no new value specified

C:\Users\ ...\AndroidStudioProjects\ ...\app\src\main\AndroidManifest.xml Error: Validation failed, exiting

(as in Android X: tools:replace specified at line: for attribute, but no new value specified).

Should I migrate the app to AndroidX?

CoolMind
  • 26,736
  • 15
  • 188
  • 224
  • I solved it by migrating to AndroidX. I met another error (https://stackoverflow.com/questions/56807023/androidx-could-not-determine-artifacts-for-androidx-multidexmultidex2-0-0) and fixed it. – CoolMind Jul 04 '19 at 08:08
  • May be helpful to others, updating google play services to latest cause this issue for me. – Abhishek Garg May 08 '20 at 06:01

0 Answers0