将com.google.android.gms版本更新为10.2.6

时间:2017-10-02 05:33:36

标签: android android-gradle google-play-services

无法解决此错误。不确定它要求的更新。

  

错误:任务':app:processDebugGoogleServices'的执行失败。   请修改版本冲突,方法是更新google-services插件的版本(https://bintray.com/android/android-tools/com.google.gms.google-services/提供有关最新版本的信息)或将com.google.android.gms版本更新为10.2.6。

这是我的build.gradle(app):     apply plugin:'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.example.kenyon.fakeinsta"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner         
"android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),     
'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
})
    compile 'com.android.support:appcompat-v7:+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'

    //design library coordination layout and toolbar
    compile 'com.android.support:design:26.+'

    //bottom navigation view ex library
    compile 'com.github.ittianyu:BottomNavigationViewEx:1.2.1'

    //circle imageview
    compile 'de.hdodenhof:circleimageview:2.1.0'

    //universal image loader
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'

    //firebase authentication
    compile 'com.google.firebase:firebase-auth:10.2.6'

    //firebase database
    compile 'com.google.firebase:firebase-database:10.0.1'


}

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

这是我的build.gradle(项目):

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'com.google.gms:google-services:3.1.0'
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

3 个答案:

答案 0 :(得分:0)

请对firebase auth和数据库使用相同的版本。

答案 1 :(得分:0)

您的gradle文件应该是这样的

1)build.gradle(项目):

buildscript {
  repositories {
    jcenter()
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:2.3.3'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    classpath 'com.google.gms:google-services:3.0.0'
  }
}

allprojects {
  repositories {
    jcenter()
    maven {
      url "https://jitpack.io"
    }

  }
}

task clean(type: Delete) {
  delete rootProject.buildDir
}

2)build.gradle(app):

apply plugin: 'com.android.application'

android {
  compileSdkVersion 26
  buildToolsVersion "26.0.1"
  defaultConfig {
    applicationId "com.example.kenyon.fakeinsta"
    minSdkVersion 15
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
  }
  buildTypes {
    release {
      minifyEnabled false
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
}

dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])
  androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support',
    module: 'support-annotations'
  })
  //design library coordination layout and toolbar
  compile 'com.android.support:design:26.+'

  //bottom navigation view ex library
  compile 'com.github.ittianyu:BottomNavigationViewEx:1.2.1'

  //circle imageview
  compile 'de.hdodenhof:circleimageview:2.1.0'

  //universal image loader
  compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'


  compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
  compile 'com.android.support.constraint:constraint-layout:1.0.2'
  compile 'com.google.firebase:firebase-auth:10.0.1'
  compile 'com.google.firebase:firebase-database:10.0.1'
}



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

注意

如果你再遇到同样的问题,可以使用androidbase中工具选项卡下的firebase助手,它会自动添加所有必需的依赖项。

答案 2 :(得分:0)

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
    applicationId "com.example.kenyon.fakeinsta"
    minSdkVersion 15
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner         
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'})
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'

//design library coordination layout and toolbar
compile 'com.android.support:design:26.1.0'

//bottom navigation view ex library
compile 'com.github.ittianyu:BottomNavigationViewEx:1.2.1'

//circle imageview
compile 'de.hdodenhof:circleimageview:2.1.0'

//universal image loader
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'

//firebase authentication
compile 'com.google.firebase:firebase-auth:11.4.0'

//firebase database
compile 'com.google.firebase:firebase-database:11.4.0'


}

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

您的应用级build.gradle文件应完全如下