最新的谷歌地图库使用旧版本的支持库

use*_*676 5 android google-maps-android-api-2 build.gradle android-gradle-plugin

我最近更改了我的build.gradle文件implementation而不是使用compile.该implementation关键字强制您确保所有依赖项都使用相同的版本.

谷歌地图依赖性'com.google.android.gms:play-services-maps:12.0.1'显然使用旧版本的支持库(26.1.0)

跑完后我能够诊断出问题 ./gradlew dependencies -b app/build.gradle

这是输出:

+--- 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 (*)
Run Code Online (Sandbox Code Playgroud)

问题是:这种情况有解决方案吗?我知道使用compile而不是implementation解决问题,但compile将在2019年删除.

这是build.gradle文件:

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'
}
Run Code Online (Sandbox Code Playgroud)