为什么新 google 地点 api 不与 build.gradle 同步?
Why the new google places api is not synchronizing with build.gradle?
根据 google 的新位置 API ( https://developers.google.com/places/android-sdk/start )。我已完成此 link 中提到的所有内容并为我的项目启用了计费功能,但我仍然无法同步项目。
错误是
ERROR: Failed to resolve: com.google.android.libraries.places:1.0.0:
Install Repository and sync project
我已将 android sdk
、play services
和 google repository
更新到最新版本。
我在 Whosebug
和其他网站上搜索了很多,但没有任何问题可以解决这个问题。
我的应用级别 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
}
入门指南有错误的依赖关系(尽管它在 Migration guide). As seen on maven.google.com 上是正确的,但实际的依赖关系是:
implementation 'com.google.android.libraries.places:places:1.0.0'
请注意,还有一个 :places-compat
依赖项。
根据 google 的新位置 API ( https://developers.google.com/places/android-sdk/start )。我已完成此 link 中提到的所有内容并为我的项目启用了计费功能,但我仍然无法同步项目。 错误是
ERROR: Failed to resolve: com.google.android.libraries.places:1.0.0:
Install Repository and sync project
我已将 android sdk
、play services
和 google repository
更新到最新版本。
我在 Whosebug
和其他网站上搜索了很多,但没有任何问题可以解决这个问题。
我的应用级别 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
}
入门指南有错误的依赖关系(尽管它在 Migration guide). As seen on maven.google.com 上是正确的,但实际的依赖关系是:
implementation 'com.google.android.libraries.places:places:1.0.0'
请注意,还有一个 :places-compat
依赖项。