无法解析 com.google.android.gms play-services-auth:11.4.0 [英] Failed to resolve com.google.android.gms play-services-auth:11.4.0

查看:60
本文介绍了无法解析 com.google.android.gms play-services-auth:11.4.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为 Android FirebaseUI 编写代码 — 在我的 android 项目中进行身份验证,但从最近两天开始,我的当前代码出现错误,不知道如何修复.努力尝试,但没有以正确的方式发生.

I am trying to write code for Android FirebaseUI — Auth in my android project but from last two days, I am getting errors in my current code and don't know how to fix it. trying hard but nothing happened in the right way.

这是我的 build.gradle(project:FriendlyChat)

here is my build.gradle(project:FriendlyChat)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

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

        // 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()
        mavenLocal()
    }
}

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

这是我的 build.gradle(Module:app)

here is my build.gradle(Module:app)

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

repositories {
    mavenLocal()
    flatDir {
        dirs 'libs'
    }
}

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.1"

    defaultConfig {
        applicationId "com.google.firebase.udacity.friendlychat"
        minSdkVersion 16
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    // Displaying images
    compile 'com.android.support:design:24.2.1'
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.github.bumptech.glide:glide:3.6.1'
    compile 'com.google.firebase:firebase-database:11.0.4'
    compile 'com.google.firebase:firebase-auth:11.0.4'
   compile 'com.google.android.gms:play-services-auth:11.4.0'

    testCompile 'junit:junit:4.12'
}

推荐答案

无法解析 com.google.android.gms play-services-auth:11.4.0 .

Failed to resolve com.google.android.gms play-services-auth:11.4.0 .

maven { url "https://maven.google.com" } 添加到您的根级 build.gradle 文件

Add maven { url "https://maven.google.com" } to your root level build.gradle file

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

从 11.2.0 开始需要此 maven 存储库.

This maven repo is required starting from 11.2.0.

您也可以使用 google() 快捷方式,但请检查 使用前的要求.

You can also use the google() shortcut but check the requirements before using it.

还要注意,因为您使用的是不同的版本.使用相同的版本.

Also pay attention since you are using different version. Use the same version.

compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.firebase:firebase-auth:11.0.4'
compile 'com.google.android.gms:play-services-auth:11.4.0'

更新

Firebase Android SDK 和 Google Play 服务库 现在有独立的版本号,允许更频繁、更灵活的更新.将 google play 服务 gradle 插件版本更新到最新版本(至少 3.3.1).

Firebase Android SDKs and Google Play Services libraries now have independent version numbers, allowing for more frequent, flexible updates. Update the google play service gradle plugin version to latest version (at least 3.3.1).

classpath 'com.google.gms:google-services:4.0.1'

并将库更新到最新版本.

这篇关于无法解析 com.google.android.gms play-services-auth:11.4.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆