When I generate a new 'Empty Activity' app in Android Studio I get the following dependencies in app/build.gradle:
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'
}
If I add
implementation 'com.google.android.gms:play-services-ads:18.1.1'
I get
Dependencies using groupId com.android.support and androidx.* can not be combined but found IdeMavenCoordinates{myGroupId='com.android.support', myArtifactId='support-vector-drawable', myVersion='28.0.0', myPacking='aar', myClassifier='null'} and IdeMavenCoordinates{myGroupId='androidx.loader', myArtifactId='loader', myVersion='1.0.0', myPacking='aar', myClassifier='null'} incompatible dependencies more... (Ctrl+F1)
and
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.
What changes should I make to prevent this conflict?