根据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
我已将android sdk
,play 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'
}
我的项目级别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
}
答案 0 :(得分:5)
“入门指南”具有错误的依赖性(尽管在Migration guide上是正确的)。如maven.google.com所示,实际依赖项为:
implementation 'com.google.android.libraries.places:places:1.0.0'
请注意,还有一个:places-compat
依赖项。