Android build.gradle(模块:应用程序)与Firebase和Play服务依赖关系发生冲突 [英] Android build.gradle (Module: app) conflict with firebase and play-services dependencies
问题描述
compile'com.android.support:appcompat-v7:25.3.0 '
compile'com.android.support:support-v4:25.3.0'
compile'com.android.support:recyclerview-v7:25.3.0'
compile'com.android .support:design:25.3.0'
compile'com.google.firebase:firebase-core:10.0.1'
compile'com.google.firebase:firebase-database:10.0.1'
编译'com.google.firebase:firebase-auth:10.0.1'
编译'com.google.firebase:firebase-crash:10.0.1'
compile'com.firebaseui:firebase -ui-database:1.1.1'
compile'com.firebaseui:firebase-ui-auth:1.1.1'
compile'com.google.android.gms:play-services:10.0.1 '
在Gradle文件中显示一个错误:
所有com.android.support库必须使用完全相同的版本
规范(混合版本可能会导致运行时崩溃)。找到
的版本25.3.0,25.1.0,24.0.0 ......
我不能更新
com.google.android.gms:play-services:10.0.1
因为我得到以下错误:
请修正版本冲突或者通过更新
google-services插件的版本(有关最新版本的信息是在
可用的
https://bintray.com/android/android-tools/com.google.gms.google-services/ )
或将com.google.android.gms的版本更新为10.0.1。
当我移除Firebase依赖关系错误消失了。什么原因导致这个错误,我怎么能摆脱它?
com.firebaseui:firebase-ui-auth:10.0.1 $ c $> c>库有传递依赖关系:
com.android.support:cardview-v7:25.1.0
com .android.support:customtabs:25.1.0
您可以强制使用新版本它在你的依赖:
compilecom.android.support:cardview-v7:25.3.0
compile com.android.support:customtabs:25.3.0
警告消息中列出的其他版本,24.0.0,必须来自Play服务库。在Android Studio中,您可以打开Gradle窗口并双击:app> Tasks> android> androidDependencies 以获得依赖关系报告以查找冲突的库。
我也强烈建议替换:
compile'com.google.android.gms:play-services :10.0.1'
需要使用特定的API。他们在表1中列出了 。包括单一的
play-services
库引入了所有的API,不必要地增加了APK的大小,并且经常需要Multidex。
有关此问题的进一步讨论,请参阅此相关问题。
I'm using the following dependencies:
compile 'com.android.support:appcompat-v7:25.3.0' compile 'com.android.support:support-v4:25.3.0' compile 'com.android.support:recyclerview-v7:25.3.0' compile 'com.android.support:design:25.3.0' compile 'com.google.firebase:firebase-core:10.0.1' compile 'com.google.firebase:firebase-database:10.0.1' compile 'com.google.firebase:firebase-auth:10.0.1' compile 'com.google.firebase:firebase-crash:10.0.1' compile 'com.firebaseui:firebase-ui-database:1.1.1' compile 'com.firebaseui:firebase-ui-auth:1.1.1' compile 'com.google.android.gms:play-services:10.0.1'
In the Gradle file an error is shown:
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 25.3.0, 25.1.0, 24.0.0......
I can't update
com.google.android.gms:play-services:10.0.1
because i get the following error:
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 10.0.1.
When i remove the Firebase dependencies the error is gone. What causes this error and how can i get rid of it?
解决方案The
com.firebaseui:firebase-ui-auth:10.0.1
library has transitive dependencies on:com.android.support:cardview-v7:25.1.0 com.android.support:customtabs:25.1.0
You can force use of a newer version by explicitly including it in your dependencies:
compile "com.android.support:cardview-v7:25.3.0" compile "com.android.support:customtabs:25.3.0"
The other version listed in the warning message, 24.0.0, must be from the Play Services library. In Android Studio, you can open the Gradle window and double-click on :app > Tasks > android > androidDependencies to get a dependency report to find the conflicting libraries.
I would also strongly recommend replacing:
compile 'com.google.android.gms:play-services:10.0.1'
with the specific APIs you need. They are listed here in Table 1. Including the single
play-services
library pulls in ALL the APIs, needlessly increasing the size of your APK and frequently requiring Multidex.See this related question for further discussion of this issue.
这篇关于Android build.gradle(模块:应用程序)与Firebase和Play服务依赖关系发生冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!