I recently changed my build.gradle files to use implementation instead of compile.
The implementation keyword forces you to make sure that all of your dependencies are with the same version.
Apperantly the google maps dependency 'com.google.android.gms:play-services-maps:12.0.1' is using an older version of the support library (26.1.0)
I was able to diagnose the issue after running ./gradlew dependencies -b app/build.gradle
Here is the output:
+--- com.google.android.gms:play-services-maps:12.0.1
| +--- com.google.android.gms:play-services-base:12.0.1
| | +--- com.google.android.gms:play-services-basement:12.0.1
| | | +--- com.android.support:support-v4:26.1.0
| | | | +--- com.android.support:support-compat:26.1.0 -> 27.1.0 (*)
| | | | +--- com.android.support:support-media-compat:26.1.0
| | | | | +--- com.android.support:support-annotations:26.1.0 -> 27.1.0
| | | | | \--- com.android.support:support-compat:26.1.0 -> 27.1.0 (*)
| | | | +--- com.android.support:support-core-utils:26.1.0 -> 27.1.0 (*)
| | | | +--- com.android.support:support-core-ui:26.1.0 -> 27.1.0 (*)
| | | | \--- com.android.support:support-fragment:26.1.0 -> 27.1.0 (*)
The question is: is there a solution to this situation? I know that using compile instead of implementation solves the problem, but compile will be removed in 2019.
Here is the build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.test.myapplication"
minSdkVersion 14
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.google.android.gms:play-services-maps:12.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}