【问题标题】:Androidstudio can not resolve dependencies after adding classpath 'com.google.gms:google-services:1.5.0-beta2'添加类路径“com.google.gms:google-services:1.5.0-beta 2”后,Android Studio 无法解析依赖项
【发布时间】:2016-07-16 07:17:08
【问题描述】:

我想在根级 build.gradle 文件中添加类路径 'com.google.gms:google-services:1.5.0-beta2' 但在添加类路径后,它不断向我显示 Resolving classpath 并且它给了我错误

错误:连接超时:连接。如果您使用 HTTP 代理,请在 IDE 或 Gradle 中配置代理设置。

我的应用级 build.gradle 是

apply plugin: 'com.android.application'


android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"
    defaultConfig {
        applicationId "com.gmail.com.signingmail"
        minSdkVersion 15
        targetSdkVersion 23
        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'])
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha2'
    testCompile 'junit:junit:4.12'
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
    androidTestCompile 'com.android.support.test:runner:0.5'
    androidTestCompile 'com.android.support:support-annotations:23.4.0'
    compile 'com.google.android.gms:play-services:8.3.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
}
apply plugin: 'com.google.gms.google-services'

我的根级 build.gradle 是。

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.0-alpha5'
        classpath 'com.google.gms:google-services:1.5.0-beta2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

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

【问题讨论】:

  • 试试这个类路径 'com.google.gms:google-services:3.0.0' 和应用程序 gradle 文件的这一行结尾 :apply plugin: 'com.google.gms.google-services'
  • 您使用的是旧版本的 google play 服务。我猜 9.2 是最新的。developers.google.com/android/guides/setup 和插件developers.google.com/android/guides/google-services-plugin。从 android sdk 管理器更新您支持的存储库并更新 google play 服务。使用最新的库
  • 是的@Raghunandan 9.2.0 是最新的。
  • 编译 'com.google.android.gms:play-services:9.2.0' 和类路径 'com.google.gms:google-services:3.0.0' 也不能正常工作 错误保持不变

标签: java android android-studio google-authentication


【解决方案1】:

好的,我解决了这个问题,这是因为我的防病毒软件阻止了 android-studio 的连接。我刚刚关闭了杀毒软件,现在它可以工作了。

【讨论】:

    猜你喜欢
    • 2021-06-13
    • 2022-07-09
    • 1970-01-01
    • 1970-01-01
    • 2019-03-31
    • 2017-05-18
    • 1970-01-01
    • 2013-12-12
    相关资源
    最近更新 更多