我正在为我的android google map应用程序使用play-service-maps-8.1.0版本。然后,我尝试添加新的Google Place Service 1.0.0。现在它给我所有的gms库必须是完全相同的版本错误。我在Google的新服务参考中找不到任何地图服务。
implementation 'com.google.android.gms:play-services-maps:8.1.0'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-maps:16.0.1'
没有一个与之合作
implementation 'com.google.android.libraries.places:places:1.0.0'
我如何在同一应用程序中使用地点和地图服务?
我所有的gradle依赖项。
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.squareup.okhttp3:okhttp:3.9.1'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.android.support:design:26.1.0'
implementation 'com.google.android.gms:play-services-maps:8.1.0'
implementation 'com.google.android.libraries.places:places:1.0.0'
}
答案 0 :(得分:0)
请参见places:1.0.0:它本身会拉入play-services-maps:16.0.0
-
和places:1.1.0与play-services-maps:16.1.0
相同。
您需要将其添加到根项目的buildscript
dependencies
:
classpath "com.google.gms:google-services:4.2.0"
,这些将是模块的Java dependencies
:
dependencies {
implementation "com.android.support:design:28.0.0"
implementation "com.android.support:support-v4:28.0.0"
implementation "com.android.support:appcompat-v7:28.0.0"
implementation "com.android.support.constraint:constraint-layout:1.1.3"
implementation ("com.google.android.libraries.places:places:1.1.0") {
exclude group: "com.android.support"
}
implementation "com.squareup.okhttp3:okhttp:3.12.1"
implementation "com.google.code.gson:gson:2.8.5"
testImplementation "junit:junit:4.12"
androidTestImplementation "com.android.support.test:runner:1.0.2"
androidTestImplementation "com.android.support.test.espresso:espresso-core:3.0.2"
}
apply plugin: "com.google.gms.google-services"
对于没有任何Firebase依赖项或Play Services插件的地方,您仍需要至少添加这两个string
资源(尽管如此,该项目仍需要在Firebase上进行设置)获取所需的google_services.json
,其中包含要替换的值):
<?xml version="1.0" encoding="utf-8"?>
<resources>
<! -- Present in all applications -->
<string name="google_app_id" translatable="false">YOUR_GOOGLE_APP_ID</string>
<! -- Present in applications with the appropriate services configured -->
<string name="google_api_key" translatable="false">YOUR_MAPS_API_KEY</string>
</resources>
请参见documentation。