Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

play-services-base versus -basement dependencies (AAR) in Android

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?

like image 236
Fattie Avatar asked Apr 06 '16 20:04

Fattie


People also ask

How do I find dependencies on Google Play Services?

Google Play services dependencies The following table lists the dependencies for Google Play services that you can include in your Android app. You can filter the list by device type by selecting one of the buttons, and you can search for a specific use case or dependency name by entering text into the box that appears after the buttons.

How do I develop features that depend on Google Play Services APIs?

To develop features that depend on the Google Play services APIs in your app, complete the following steps: Open the build.gradle file inside your app's module directory. Note: Android Studio projects contain a top-level build.gradle file and a build.gradle file for each module. Be sure to edit the file for your app's module.

Do Firebase Android SDKs depend on Google Play Services?

Dependencies of Firebase Android SDKs on Google Play services. Some Firebase Android SDKs depend on Google Play services , which means they will only run on devices and emulators with Google Play...

How do I use dependencies with my Android project?

The dependencies can be located on your machine or in a remote repository, and any transitive dependencies they declare are automatically included as well. This page describes how to use dependencies with your Android project, including details about behaviors and configurations that are specific to the Android plugin for Gradle.


1 Answers

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

like image 162
Mattia Maestrini Avatar answered Oct 23 '22 13:10

Mattia Maestrini