【问题标题】:Updating Google Play Services from 8.4.0 to 9.2.1 breaks a bunch of code involving com.google.android.gms.location.places将 Google Play 服务从 8.4.0 更新到 9.2.1 会破坏一堆涉及 com.google.android.gms.location.places 的代码
【发布时间】:2016-07-21 13:08:07
【问题描述】:

我已经更新了 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"
}
}

【问题讨论】:

    标签: android google-play-services


    【解决方案1】:

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

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

    google 将places 包分成单独的API...

    【讨论】:

    【解决方案2】:

    几天前我遇到了类似的问题。您必须检查其他库是否使用 Google Play 服务以及什么版本。如果您的导入高于/低于其他库导入,那么它会破坏应用程序。检查是否有可用于其他库的更新,以实现更高的 Google Play 服务。

    我们通过更新冲突库解决了这个问题。

    【讨论】:

    • 感谢您的快速回复!如何检查其他库以查看它们是否回复旧版本的播放服务?
    • 尝试用谷歌搜索他们。最好的方法是正确读取堆栈跟踪并缩小导致错误的库。这取决于您使用的库。他们中的大多数都在 github 上,您可以检查那里是否有更高版本的更新,您还可以检查他们的 gradle 构建文件他们正在使用哪些库
    • 这是一个编译时错误(导入失败)不是运行时所以不能使用堆栈跟踪。
    • 你能提供你的 gradle 构建文件吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-09-21
    • 1970-01-01
    • 2012-11-15
    • 1970-01-01
    • 1970-01-01
    • 2016-11-19
    • 1970-01-01
    相关资源
    最近更新 更多