【问题标题】:Google Play service for Location conflicts with Firebase dependenciesGoogle Play 位置服务与 Firebase 依赖项冲突
【发布时间】:2016-12-21 06:22:20
【问题描述】:
Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the
google-services plugin (information about the latest version is available
at https://bintray.com/android/android-tools/com.google.gms.google-services/)
or updating the version of com.google.android.gms to 9.6.1.

apply plugin: 'com.android.application'

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

    compileSdkVersion 23
    buildToolsVersion "23.0.2"
    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        applicationId "com.myapp"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        // Enabling multidex support.
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:design:23.0.1'

    compile 'com.firebase:firebase-client-android:2.3.1'
    compile 'com.google.firebase:firebase-database:9.6.1'
    compile 'com.google.firebase:firebase-storage:9.6.1'
    //map
    compile 'com.google.android.gms:play-services-location:9.0.2'
}
apply plugin: 'com.google.gms.google-services'

当我将它更新到 9.6.1 时,有些类找不到

  1. SupportMapFragment 类
  2. OnMapReadyCallback、GoogleMap.OnMarkerClickListener、GoogleMap.OnInfoWindowClickListener 监听器
  3. LatLng、LatLngBounds、GoogleMap、标记类

【问题讨论】:

  • 对于这些课程,请添加compile 'com.google.android.gms:play-services-maps:9.6.1'
  • 当我将其更新到 9.6.1 时,找不到某些类:SupportMapFragment 类 OnMapReadyCallback、GoogleMap.OnMarkerClickListener、GoogleMap.OnInfoWindowClickListener 侦听器 LatLng、LatLngBounds、GoogleMap、Marker 类
  • 是的,只要继续使用 9.6.1 版本的 play-services-location 和 play-services-maps,课程就会出现。您缺少 play-services-maps 依赖项

标签: android google-maps firebase


【解决方案1】:

尝试将映射依赖项添加到您的 gradle 文件中

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

【讨论】:

  • 然后我不能 ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();方法
  • 使用 getMapAsync(new OnMapReadyCallback(){ @Override public void onMapReady(GoogleMap googleMap) { // 用 googleMap 做任何你想做的事情}); 代替 getMap()
猜你喜欢
  • 1970-01-01
  • 2019-04-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多