Android dependency com.google.firebase:firebase-co

2019-07-21 00:25发布

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

3条回答
欢心
2楼-- · 2019-07-21 00:42

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'
查看更多
We Are One
3楼-- · 2019-07-21 00:47

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.

查看更多
唯我独甜
4楼-- · 2019-07-21 00:52

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'
查看更多
登录 后发表回答