Android dependency com.google.firebase:firebase-core different version for the compile (12.0.1) and runtime (11.4.2)

妖精的绣舞 提交于 2019-12-12 19:41:14

问题


this is my Project Gradle dependencies

classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.google.gms:google-services:3.0.0'
classpath "io.realm:realm-gradle-plugin:4.2.0"
classpath 'com.google.firebase:firebase-plugins:1.1.1'

this is my App Gradle dependencies

implementation 'com.google.android.gms:play-services-ads:11.4.2'
implementation 'com.google.firebase:firebase-core:11.4.2'
implementation 'com.google.android.gms:play-services-base:11.4.2'
implementation 'com.google.firebase:firebase-messaging:11.4.2'

Also i have change implementation to api ... the error still appears


回答1:


add below dependency into app level gradle file ..

    implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.google.firebase:firebase-core:15.0.2'
implementation 'com.google.android.gms:play-services-base:15.0.1'
implementation 'com.google.firebase:firebase-messaging:15.0.2'



回答2:


You just need to change your google lib version into the stable version. you are using an unstable version. Use following

implementation 'com.google.android.gms:play-services-location:12.0.0'
implementation 'com.google.android.gms:play-services-places:12.0.0'
implementation 'com.google.firebase:firebase-messaging:12.0.0'
implementation 'com.google.firebase:firebase-core:12.0.0'

and use this classpath

classpath 'com.google.gms:google-services:3.1.1'

and remove the firebase classpath from the project

classpath 'com.google.firebase:firebase-plugins:1.1.1'



回答3:


Where do you apply the google-services plugin? https://developers.google.com/android/guides/google-services-plugin#introduction requires you apply it at the bottom of your app's build.gradle to avoid dependency collisions similar to the one you are describing.

You can also run ./gradlew :app:dependencies to see if you have any dependency collisions which lead to multiple versions of firebase-core.



来源:https://stackoverflow.com/questions/50328801/android-dependency-com-google-firebasefirebase-core-different-version-for-the-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!