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

后端 未结 5 1616
小鲜肉
小鲜肉 2020-12-07 13:01

A library that I wrote myLib uses RemoteMessage from Firebase, the app itself also uses Firebase.

Using gradle 4.7

5条回答
  •  不思量自难忘°
    2020-12-07 13:50

    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.

提交回复
热议问题