user1785730
user1785730

Reputation: 3547

Which com.google.android.gms:play-services-ads version is compatible with com.android.support:appcompat-v7:27.1.1?

No duplicate: In my question I've already linked an answer similar to the supposed duplicate and explained, why I'm not looking for such an answer.

Android Studio 3.2.1 automatically included

implementation 'com.android.support:appcompat-v7:27.1.1'

for my new app. I manually included

implementation 'com.google.android.gms:play-services-ads:17.1.1'

following the official guide.

The official guide from google seems to be outdated, as Android Studio immediately suggests using version 17.1.3 instead.

In both cases however there is a red line under appcompat-v7 and a tooltip warning me that:

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 27.1.1, 26.1.0.

I do get the general problem here, play-services-ads transitively depends on an old version of some support library. This answer suggests to simply include the offending libraries manually in the correct version.

However, I don't like this solution for two reasons:

  1. I simply don't want to deal with problems like this. There should be compatible versions available for the google libraries.

  2. At some point in the future I might have forgotten why I included all these libraries I don't even know what they do. I might want to update the appcompat and play-services-ads dependencies without thinking about all this again.

Is version 17.1.3 the most recent version of play-services-ads as of now? Does that mean that play-services-ads is generally lagging behind? If so, I would prefer to downgrade appcompat-v7 instead of including some library versions manually.

What would be the correct version of appcomat-v7 for play-services-ads version 17.1.3? Or maybe more generally asked: Which are the most recent versions of appcompat-v7 and play-services-ads that work together hassle free?

Upvotes: 1

Views: 1628

Answers (1)

user1785730
user1785730

Reputation: 3547

26.1.0 is the correct appcompat-v7 version for play-services-ads 17.1.*

implementation 'com.android.support:appcompat-v7:26.1.0'

This also requires compileSdkVersion and targetSdkVersion to be set to 26.

Upvotes: 1

Related Questions