将Google Play服务从8.4.0更新为9.2.1会破坏大量涉及com.google.android.gms.location.places的代码

时间:2016-07-21 13:08:08

标签: android google-play-services

我更新了Google Play服务,现在似乎缺少一些类:

com.google.android.gms.location.places.AutocompleteFilter
com.google.android.gms.location.places.AutocompletePrediction
com.google.android.gms.location.places.AutocompletePredictionBuffer
com.google.android.gms.location.places.Places
com.google.android.gms.location.places.Place
com.google.android.gms.location.places.PlaceBuffer
com.google.android.gms.location.places.PlaceLikelihood
com.google.android.gms.location.places.PlaceLikelihoodBuffer

我查看了发布说明https://developers.google.com/android/guides/releases和API参考https://developers.google.com/android/reference/com/google/android/gms/location/places/package-summary,但没有迹象表明这些类已被替换。

有人可以告诉我发生了什么事吗?

谢谢,

里兹

编辑:这是gradle构建文件

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    mavenCentral()
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
    maven { url 'https://maven.fabric.io/public' }
}

configurations {
    compile.exclude group: 'com.google.guava'
    compile.exclude module: 'guava:19.0-rc2'

    all*.exclude group: 'commons-logging', module: 'commons-logging'

    androidTestCompile.exclude group: 'com.google.code.findbugs'
    androidTestCompile.exclude module: 'jsr305:2.0.1'
}

dependencies {
    //project
    compile project(':MyGeneralLibrary')

    compile fileTree(dir: '../libs', include: '*.jar')

    compile 'com.google.android.gms:play-services-maps:9.2.1'
    compile 'com.google.android.gms:play-services-location:9.2.1'
    compile 'com.google.android.gms:play-services-auth:9.2.1'
    compile 'com.google.android.gms:play-services-plus:9.2.1'

    compile 'com.android.support:support-annotations:24.1.0'
    compile 'org.twitter4j:twitter4j-core:4.0.2'
    compile 'com.facebook.android:facebook-android-sdk:4.10.0'
    compile 'com.github.scribejava:scribejava-apis:2.2.2'
    compile('com.twitter.sdk.android:twitter:1.12.1@aar') {
        transitive = true;
    }
    compile 'com.google.code.findbugs:jsr305:1.3.9'
    compile 'com.firebase:firebase-client-android:2.5.2'

    //unit tests
    testCompile project(':TestUtils')
    testCompile 'org.hamcrest:hamcrest-library:1.3'
    testCompile 'junit:junit:4.12'
    testCompile 'org.mockito:mockito-core:1.10.19'
    testCompile 'com.android.support:support-annotations:24.1.0'

    //instrumentation tests
    androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
    androidTestCompile 'junit:junit:4.12'
    androidTestCompile 'com.android.support.test:rules:0.4.1'
    androidTestCompile 'com.android.support:support-annotations:24.1.0'
    androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.1'
    androidTestCompile 'com.google.code.findbugs:jsr305:1.3.9'
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.1') {
        exclude group: 'com.android.support', module: 'support-annotations'
    }
    androidTestCompile('com.android.support.test:runner:0.4.1') {
        exclude group: 'com.android.support', module: 'support-annotations'
    }
}

apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "0.01"
        applicationId "com.chdryra.android.reviewer"
        testInstrumentationRunner    "android.support.test.runner.AndroidJUnitRunner"
}

sourceSets {
    main {
        res.srcDirs = ['src/main/res', 'src/androidTest/res']
    }
}

packagingOptions {
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/LICENSE-FIREBASE.txt'
    exclude 'META-INF/NOTICE.txt'
}

dexOptions {
    javaMaxHeapSize "2g"
}
}

2 个答案:

答案 0 :(得分:1)

如果您仍然遇到上述问题,请更改gradle构建文件以包含以下两行:

compile 'com.google.android.gms:play-services-places:9.2.1'
compile 'com.google.android.gms:play-services-location:9.2.1'

谷歌将地方包分成单独的API ...

答案 1 :(得分:0)

我几天前遇到过类似的问题。如果他们使用的是Google Play服务以及版本,您必须查看其他图书馆。如果您的导入高于/低于其他库导入,则会导致应用程序中断。检查是否有可用于其他图书馆的更新,以实施更高的Google Play服务。

我们通过更新冲突的库来解决它。