为什么新的Google Places API无法与build.gradle同步?

Gop*_*rvi 1 android google-places-api

根据google的新地方API(https://developers.google.com/places/android-sdk/start)。我已经完成了此链接中提到的所有操作,并为我的项目启用了结算功能,但是仍然无法同步项目。错误是

ERROR: Failed to resolve: com.google.android.libraries.places:1.0.0:
Install Repository and sync project
Run Code Online (Sandbox Code Playgroud)

我已经更新了android sdkplay services并更新google repository到了最新版本。我在stackoverflow其他网站上搜索了很多内容,但是对此没有疑问。

我的应用程序级别build.gradle文件是

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'
}
Run Code Online (Sandbox Code Playgroud)

我的项目级别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.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
}
Run Code Online (Sandbox Code Playgroud)

ian*_*ake 5

《入门指南》具有错误的依赖性(尽管在《迁移指南》上是正确的)。如在maven.google.com看到的,实际依赖项为:

implementation 'com.google.android.libraries.places:places:1.0.0'
Run Code Online (Sandbox Code Playgroud)

注意也有一个:places-compat依赖项。