且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

获得"多个库包名“com.google.android.gms'"运行磨损模块时,

更新时间:2022-06-04 07:46:53

的问题更是你有相同的应用程序(6.1版本和6.5版本)中使用多个不同版本的谷歌游戏服务。您可以更新您的共享(和应用程序)的模块使用编译com.google.android.gms:发挥服务:6.5 + 键,那么你就只能有一个。谷歌Play版本服务,并避免你所面临的问题。

The issue is more that you have multiple different versions of Google Play Services being used within the same app (version 6.1 and version 6.5). You can update your shared (and app) modules to use compile 'com.google.android.gms:play-services:6.5.+ and then you'll only have one version of Google Play Services and avoid the issue you are facing.

在你的情况,你只需要定义谷歌播放服务共享的模块中 - 假设你的应用程序和磨损的模块都有它的依赖性,它们会自动继承任何依赖关系,以便重新声明它们是多余的(虽然它不 ŧ伤害的事情,如果你preFER做反正)。

In your case, you only need to define Google Play Services in the shared module - assuming your app and wear modules both have a dependency on it, they'll automatically inherit any dependencies so redeclaring them is unnecessary (although it doesn't harm things if you prefer to do it anyways).

注:播放服务耐磨库是众多的分库在谷歌使用播放服务6.5 - 这确实让你只包括谷歌的部分播放服务在您的应用程序的需要。在几乎所有情况下,应该考虑将明确依赖于只有谷歌的部分播放服务,而不是使用 com.google.android.gms:整体发挥服务 :由包括整个 com.google.android.gms:发挥服务甚至一度您在所有谷歌Play服务的拉动,即使以后你声明或使用一个单一的一部分该库。

Note: the play-services-wearable library is one of the many split libraries available in Google Play Services 6.5 - these do indeed allow you to only include the parts of Google Play Services you need in your application. In almost all cases, you should consider moving to explicitly depending on only the parts of Google Play Services rather than using com.google.android.gms:play-services in its entirety: by including the entire com.google.android.gms:play-services even once you pull in all of Google Play services even if later you declare or use a single portion of the library.