Failed to resolve: com.google.android.gms:play-services in IntelliJ Idea with gradle

前端 未结 13 1890
一向
一向 2020-12-02 11:09

I\'m trying to add google play services to my libGDX project in IntelliJ Idea. I\'ve followed the setup guide here: https://developers.google.com/android/guides/setup

<
相关标签:
13条回答
  • 2020-12-02 11:25

    Check you gradle settings, it may be set to Offline Work

    0 讨论(0)
  • 2020-12-02 11:29

    At the latest Google Play Services 15.0.0, it occurs this error when you include entire play service like this

    implementation 'com.google.android.gms:play‐services:15.0.0'
    

    Instead, you must specific the detail service like Google Drive

    com.google.android.gms:play-services-drive:15.0.0
    
    0 讨论(0)
  • 2020-12-02 11:35

    I tried solving this problem for hours after I haven't used Android Studio some time and wasn't aware of the updates.

    It is important that google() is the first item that stands in repositories like this:

    allprojects {
        repositories {
            google()
            jcenter()
            mavenCentral()
        }
    }
    

    Somehow google() was the second item after jcenter(), so everything was messed up and didn't work. Maybe this helps someone.

    0 讨论(0)
  • 2020-12-02 11:37

    I had the issue when I put jcenter() before google() in project level build.gradle. When I changed the order and put google() before jcenter() in build.gradle the problem disappeared

    Here is my final build.gradle

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    buildscript {
    
        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.1.3'
    
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    
    0 讨论(0)
  • 2020-12-02 11:37

    Add this to your project-level build.gradle file:

    repositories {
        maven {
            url "https://maven.google.com"
        }
    }
    

    It worked for me

    0 讨论(0)
  • 2020-12-02 11:37

    I hade the same problem and it resolved by disabling cradle offline mode although I could not remember when I did disable it!

    heres the solution:

    How to disable gradle 'offline mode' in android studio? [duplicate]

    0 讨论(0)
提交回复
热议问题