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?

user1785730
  • 3,150
  • 4
  • 27
  • 50
  • 1
    Possible duplicate of [Gradle mixing versions 27.1.1 and 26.1.0 \[Android Studio\]](https://stackoverflow.com/questions/54088736/gradle-mixing-versions-27-1-1-and-26-1-0-android-studio) – Martin Zeitler Feb 08 '19 at 23:02
  • like it or not, this is how to deal with conflicting versions - while it tells you that it depends on version `26.1.0` - which is the version you might be looking for; in case you intend to build against the same outdated version. – Martin Zeitler Feb 08 '19 at 23:03
  • Well, I think I made it very clear, that this is not the kind of solution I'm looking for. What about downgrading appcompat-v7? – user1785730 Feb 08 '19 at 23:07
  • And I would appreciate a comment on why play-services-ads doesn't get updated. – user1785730 Feb 08 '19 at 23:08
  • @user1785730,good observation ,I am also face this problem in many times when I work with gradle and google-paly-services ,and try to update till reach for suitable solution. – engmms Feb 09 '19 at 01:26

1 Answers1

1

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.

user1785730
  • 3,150
  • 4
  • 27
  • 50