在最后一次sdk更新后,android studio无法找到任何google play服务或firebase库

时间:2017-03-03 08:03:19

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

我有一个工作项目,但昨天我更新了android sdk和sdk工具。

然后突然间我

Failed to resolve: com.google.android.gms:play-services-maps:10.2.0
Failed to resolve: com.google.firebase:firebase-messaging:10.2.0
Failed to resolve: com.google.firebase:firebase-core:10.2.0

这在我的所有Android项目中都会发生!

即使在一个离子项目中,这也很好,现在它正在给我 Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.

android studio 2.3或api 25r3的更新有什么变化吗?

如果我转到模块设置>依赖项并尝试从choose library dependency窗口添加这些库,我无法找到它们:

when searching foor play-services

我的SDK工具:

enter image description here

我已经正确配置了所有内容,因为项目已经正常运行。

我的build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.0'

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

    defaultConfig {
        applicationId "com.myapp"
        minSdkVersion 17
        targetSdkVersion 25
        versionCode 3
        versionName "1.0"
        multiDexEnabled true
        renderscriptTargetApi 22
        renderscriptSupportModeEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:25.0.0'
    compile 'com.android.support:support-v4:25.0.0'
    compile 'com.android.support:design:25.0.0'
    compile 'uk.co.chrisjenx:calligraphy:2.2.0'
    compile 'com.facebook.android:facebook-android-sdk:4.+'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
    compile 'com.google.android:flexbox:0.2.3'
    compile 'com.android.support:recyclerview-v7:25.0.0'
    compile 'com.android.support:cardview-v7:25.0.0'
    compile 'com.google.code.gson:gson:2.7'
    compile 'org.apache.commons:commons-lang3:3.4'
    compile 'com.google.gms:google-services:3.0.0'
    compile 'com.google.firebase:firebase-core:10.2.0'
    compile 'com.google.firebase:firebase-messaging:10.2.0'
    compile 'com.squareup.retrofit2:retrofit:2.1'
    compile 'com.squareup.retrofit2:converter-gson:2.+'
    compile 'com.squareup.retrofit2:converter-jackson:2.+'
    compile 'com.squareup.okhttp3:okhttp:3.4.1'
    compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
    compile 'com.google.android.gms:play-services-maps:10.2.0'
    compile 'fr.tvbarthel.blurdialogfragment:lib:2.2.0'
    compile 'com.mattluedke:snowshoelib:1.0.4'
    compile 'com.facebook.rebound:rebound:0.3.8'
    testCompile 'junit:junit:4.12'
}





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

任何人都有同样的问题吗?

2 个答案:

答案 0 :(得分:3)

解决方案是通过从SDK管理器中删除google repository并再次安装来解决的。

答案 1 :(得分:1)

在您的终端

nano ~/.bash_profile 

添加行:

export ANDROID_HOME=/YOUR_PATH_TO/android-sdk
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools:$PATH