简体   繁体   中英

error crash implementation 'com.android.support:appcompat-v7:28.0.0'

this is my dependencies (module:app)

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    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.gms:play-services:12.0.1'
}

after added implementation 'com.google.android.gms:play-services:12.0.1' , sync module:app always error on implementation 'com.android.support:appcompat-v7:28.0.0'

error :

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.0] 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.

How about migrating to AndroidX by selecting Refactor > Migrate to AndroidX and let the refactor do the work

It seems you don't want to migrate to AndroidX but you should give it a try, since android support 28.0.0 is the last release and android will only update androidx from now.

https://developer.android.com/topic/libraries/support-library/revisions#28-0-0

This is the stable release of Support Library 28.0.0 and is suitable for use in production. This will be the last feature release under the android.support packaging, and developers are encouraged to migrate to AndroidX.

You are using both support library and androidx library in one project, that's the issue.

Change the support libraries to the preferred AndroidX library.

implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
testİmplementation 'junit:junit:4.13-beta-3'
androidTestİmplementation 'androidx.test:runner:1.3.0-alpha01'
androidTestİmplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha01'

etc.......

and also you can Migrate to AndroidX from Android Studio itself

Simply go to Refactor > Migrate to AndroidX > Migrate

more info for migration check this

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM