Tai*_*han 2 android google-maps firebase android-gradle-plugin
我正在学习Android,同时做一些工作.我正在尝试将应用程序的版本更新为Android 8.0,其中包括使用的sdk,库和外部API.
我查了一下,似乎15.0.1是建议的版本.但是当我使用它时,gradle失败play-services-analytics并且firebase服务同步说它无法解析库,如果按下Install Repository也无法找到存储库.
所以目前我正在使用12.0.1版本来播放服务和firebase服务.使用它像:
implementation 'com.google.android.gms:play-services-maps:12.0.1'
implementation 'com.google.android.gms:play-services-analytics:12.0.1'
implementation 'com.google.android.gms:play-services-ads:12.0.1'
implementation 'com.google.android.gms:play-services-auth:12.0.1'
implementation 'com.google.android.gms:play-services-gcm:12.0.1'
implementation 'com.google.firebase:firebase-core:12.0.1'
implementation 'com.google.firebase:firebase-analytics:12.0.1'
implementation 'com.google.firebase:firebase-crash:12.0.1'
implementation 'com.google.firebase:firebase-messaging:12.0.1'
implementation 'com.android.support:support-v4:27.1.0'
implementation 'com.android.support:appcompat-v7:27.1.0'
Run Code Online (Sandbox Code Playgroud)
但是,如果我尝试仅使用play-services除分析之外的15.0.1,那么它会给我另一个警告,即使用不同版本的播放服务和firebase服务可能会导致运行时崩溃.
所以它让我处于一个奇怪的境地,我用Google搜索和搜索,但无法找到任何对我有用的东西......在这里处理这个问题的正确方法是什么?我应该满足于12.0.1吗?或更新有用的东西?(之前的版本是9.4.0或类似的东西;在我进行Android 8.0升级之前)
编辑:这些是我的顶级gradle依赖项
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.2'
Run Code Online (Sandbox Code Playgroud)
如果版本大于或等于15,则不能混合小于或等于12的firebase和google play服务版本.
因此,您需要更新所有这些库的版本号:
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-analytics:15.0.1'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-analytics:16.0.1'
implementation 'com.google.firebase:firebase-crash:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.1.0'
Run Code Online (Sandbox Code Playgroud)
检查一下:
https://firebase.google.com/support/release-notes/android
https://android-developers.googleblog.com/2018/05/announcing-new-sdk-versioning.html
从版本15开始,每个Maven依赖项匹配
com.google.android.gms:play-services-*并且com.google.firebase:firebase-*不再需要具有相同的版本号,以便在构建时和运行时正常工作.
还可以在顶级gradle文件中使用以下google play服务插件:
classpath 'com.google.gms:google-services:4.0.1'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1388 次 |
| 最近记录: |