10

I found an xml file GoogleDependencyFlurryPlugin.xml

<dependencies>
<dependency><groupId>com.google.android.gms</groupId><artifactId>play-services-base</artifactId><version>8.4+</version></dependency>
<dependency><groupId>com.google.android.gms</groupId><artifactId>play-services-basement</artifactId><version>8.4+</version></dependency>
</dependencies>

and indeed an xml file GoogleDependencyPlayGameServicesPlugin.xml

<dependencies>
<dependency><groupId>com.google.android.gms</groupId><artifactId>play-services-games</artifactId><version>8.4+</version></dependency>
<dependency><groupId>com.google.android.gms</groupId><artifactId>play-services-plus</artifactId><version>8.4+</version></dependency>
</dependencies>

Now, at one point the former file had ONLY

play-services-base > OR < play-services-basement

and that seemed to cause a huge problem. AndroidJavaException: java.lang.NoSuchMethodError: once running on a device.

Android experts, is it the case that if you have "base" you must have "basement" ... or perhaps vice versa?

Indeed, WRT play-services-games or play-services-plus, perhaps one/both of those depend in some way (or contradict?) base/basement?

Community
  • 1
  • 1
Fattie
  • 27,874
  • 70
  • 431
  • 719
  • If you look in your app/build directory in Android Studio after compilation, you'll notice that `basement` has additional classes that `base` doesn't have. I.e. it has **zze.class**, which `GooglePlayServicesUtil` extends from. – IgorGanapolsky Aug 23 '16 at 15:51

1 Answers1

17

The library play-services-basement is a dependency of play-services-base. It was introduced in Google Play Service version 8.1.0 to help to reduce the size of some other libraries like play-services-ads and play-services-analytics.

When you add play-services-base you automatically add also play-services-basement so it's not necessary to add the explicit dependency.

You can check the dependencies of every single library in your local Google repository.

For example for the library play-services-games open the file pom file that is located here:

extras/google/m2repository/com/google/android/gms/play-services-games/8.4.0/play-services-games-8.4.0.pom

this is the content of the file:

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.google.android.gms</groupId>
  <artifactId>play-services-games</artifactId>
  <version>8.4.0</version>
  <packaging>aar</packaging>
  <dependencies>
    <dependency>
      <groupId>com.google.android.gms</groupId>
      <artifactId>play-services-base</artifactId>
      <version>8.4.0</version>
      <scope>compile</scope>
      <type>aar</type>
    </dependency>
    <dependency>
      <groupId>com.google.android.gms</groupId>
      <artifactId>play-services-drive</artifactId>
      <version>8.4.0</version>
      <scope>compile</scope>
      <type>aar</type>
    </dependency>
  </dependencies>
</project>

As you can see play-services-games depends on play-services-base and play-services-drive

Mattia Maestrini
  • 32,270
  • 15
  • 87
  • 94
  • Thanks for this incredible answer! So in fact, regarding the first file since it has `play-services-base`, actually there is no point adding `play-services-basement` - I've understood you correctly? Thanks! – Fattie Apr 07 '16 at 10:30
  • Yes, you are right, there is no point in adding `play-services-basement` if you already add `play-services-base`. – Mattia Maestrini Apr 07 '16 at 14:53
  • got it, **thanks**. for the other, since it uses play-services-games, do you mean I **must** include play-services-base and play-services-drive? Or did I misunderstand you? thanks... – Fattie Apr 07 '16 at 14:58
  • You don't need to explicitly add `play-services-base` and `play-services-drive` because they are automatically added since they are the dependency of `play-services-games` – Mattia Maestrini Apr 07 '16 at 15:06
  • Why don't I see **play-services-base** listed here: https://developers.google.com/android/guides/setup#split – IgorGanapolsky Jul 12 '16 at 16:05
  • 1
    The list identifies only the dependencies that map a public API. There are many different dependencies. You can see all the available dependencies in your local `Google repository` located here: `/extras/google/m2repository/com/google/android/gms/` – Mattia Maestrini Jul 12 '16 at 16:20
  • 2
    If you're Google and you already reached the `base`, you apparently only can go deeper by going to the `basement` :) – Thomas Keller Apr 11 '18 at 13:19