在lib模块中更新Google Play服务

时间:2016-12-03 16:45:04

标签: android google-play-services

将旧项目的Google Play服务插件更新为 com.google.gms:google-services:3.0.0, 我遇到了以下问题:

我的项目有一个由其他应用程序模块共享的lib模块,其gradle构建文件是:

apply plugin: 'com.android.library'
android {
    compileSdkVersion 25
    buildToolsVersion "25.0.1"
    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 25
        versionCode 22
        versionName "2.11"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:25.0.1'
    compile 'com.google.android.gms:play-services-location:10.0.1'
    compile 'com.google.android.gms:play-services-wearable:10.0.1'
}

构建项目时,我收到以下错误:

Error:(54, 41) error: package com.google.android.gms.maps.model does not exist

Error:(770, 19) error: cannot find symbol class LatLng

回归:

compile 'com.google.android.gms:play-services-location:9.0.0'
compile 'com.google.android.gms:play-services-wearable:9.0.0'

一切正常。

有什么想法吗?

1 个答案:

答案 0 :(得分:2)

看起来LatLng类已移至新位置。将以下内容添加到构建文件中:

compile 'com.google.android.gms:play-services-maps:10.0.1'

这将下载包含该类的组件,您的编译应该会成功。