根据谷歌新的places 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
}
发布于 2019-03-07 05:59:13
入门指南有错误的依赖关系(尽管它在Migration guide上是正确的)。正如在maven.google.com上所看到的,实际的依赖关系是:
implementation 'com.google.android.libraries.places:places:1.0.0'
请注意,还有一个:places-compat
依赖项。
https://stackoverflow.com/questions/55036888
复制