Gradle: More than one variant of project :myLib matches the consumer attributes

霸气de小男生 提交于 2019-11-28 03:14:10

The google-services gradle plugin is made to work with Google Play Services and Firebase 15+, but you're using it with version 12.0.1.

The solution is to either:

  • Upgrade your Play Services and Firebase dependencies to version 15+ (note that they have different versions now)
  • Cancel your google-services upgrade to 3.3.0 until you upgrade to 15+, that is, downgrading the gradle plugin to version 3.2.1.

EDIT 1: There's a known issue about using google-services 3.3 in multimodule apps. That means downgrading to google-services to 3.2.1 may be your only option until a new version that fixes the bug is released.

EDIT 2: The bug mentioned above has been fixed in the version 4.0.1 of the google-services gradle plugin! (and the version 4.0.2 also fixes an NPE that occurred in some cases)

BTW, you should move to FCM. GCM will stop working in a not too distant future.

I got this error when I use google-services:3.3.0.

Downgrade to classpath 'com.google.gms:google-services:3.2.1' in your project .gradle.

It should solve the issue.

Update: It should probably not occur in the current versions.

Faced with similar issue while upgrading to 3.3.1

Fixed it by downgrading to 3.2.1

We can use firebase version >=15 with 3.2.1

Below steps worked for me ---

  1. Go to the android/build.gradle file.
  2. Search for jcentre() method.
  3. Shift all the jcenter() methods to the bottom inside its block.

I faced a similar issue in past few days with.

implementation 'com.google.android.gms:play-services-auth:15.0.0'
implementation 'com.google.firebase:firebase-messaging:15.0.0'

solution was to either downgrade to

implementation 'com.google.android.gms:play-services-auth:12.0.1'
implementation 'com.google.firebase:firebase-messaging:12.0.1'

or consider leaving Google Cloud Services and upgrading to FCM entirely

Note that they have different version numbers you can look it up here

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