-2

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.
Ica
  • 59
  • 1
  • 11
  • what error????? – John Joe Jul 17 '19 at 03:54
  • Whats the error ? Also do not use `com.google.android.gms:play-services` Use separate dependency for the APIs you want to use Follow [This](https://developers.google.com/android/guides/setup). – ADM Jul 17 '19 at 03:59
  • 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 element at AndroidManifest.xml:5:5-19:19 to override. – Ica Jul 17 '19 at 04:15
  • i use implementation this 'com.google.android.gms:play-services-location:17.0.0', same error – Ica Jul 17 '19 at 04:16
  • Did you see the suggestion at the end of the error? – OneCricketeer Jul 17 '19 at 04:18
  • I had tried the suggestion. didn't solve anything. unless I migrate to androidx, it solved but i don't know what this androidx. isn't any way to solving the issue without migration to androidx????? – Ica Jul 17 '19 at 04:27

2 Answers2

0

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.

NightKnight
  • 38
  • 1
  • 1
  • 6
0

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

Basi
  • 3,009
  • 23
  • 28