Gopal Singh Sirvi
Gopal Singh Sirvi

Reputation: 4649

Why the new google places api is not synchronizing with build.gradle?

According to google's new places API ( https://developers.google.com/places/android-sdk/start ). I have done everything mentioned at this link and enabled billing for my project but still I am unable to sync project. The error is

ERROR: Failed to resolve: com.google.android.libraries.places:1.0.0:
Install Repository and sync project

I have updated android sdk, play services and google repository to the latest version. I have searched for a lot on stackoverflow and other sites but there is no question available realted to this.

My app level build.gradle file is

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.prisma.placesapidemo"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0-beta01'
    implementation 'com.google.android.material:material:1.0.0-beta01'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
    implementation 'com.google.android.libraries.places:1.0.0'
}

My project level build.gradle file is

// 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.3.1'
        classpath 'com.google.gms:google-services:4.0.1'
        // 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
}

Upvotes: 1

Views: 377

Answers (1)

ianhanniballake
ianhanniballake

Reputation: 200080

The Getting Started guide has the wrong dependency (despite it being correct on the Migration guide). As seen on maven.google.com, the actual dependency is:

implementation 'com.google.android.libraries.places:places:1.0.0'

Note there is also a :places-compat dependency as well.

Upvotes: 5

Related Questions