简体   繁体   中英

After the last sdk update, android studio can't find any google play service or firebase library

I had a working project, but yesterday I updated the android sdk and sdk tools.

and suddenly I'm getting

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

This is happening in all my android projects!

Even in an ionic project, that was also working fine, now it is giving me Could not find gradle wrapper within Android SDK. Might need to update your Android SDK. Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.

Anything changed in the update to android studio 2.3 or api 25r3 ?

If I go to module settings > dependencies and try to add these libraries from the choose library dependency window, I can't find them :

搜索游玩服务时

My SDK tools :

在此处输入图片说明

I already have everything configured correctly, since the project was already working.

my 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'

Anyone has the same issue ?

解决方案通过从SDK管理器中删除google repository并重新安装来解决。

In your terminal

nano ~/.bash_profile 

Add lines:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM