When trying to add a library for advertising from adMob

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

underlines in red

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

enter image description here

And shows the error

All com.android.support libraries must use the exact same version specification

enter image description here

  • the error says that you cannot use different versions of the library and they advise you to use the same version Try clicking on what is underlined and see what the studio offers you. - Andrew Goroshko
  • one
    'com.google.android.gms:play-services-ads:17.1.0' contains a transitive dependency within itself. The exclude module: 'appcompat-v7' in the options for connecting the admob library can help. In general, you can leave as is. This is a warning. Well, the command gradlew app:dependencies just in case. - pavel
  • Please tell me, where exactly should they be inserted? - Artsait
  • @Artsait think so implementation ('com.android.support:support-v4:28.0.0'){ exclude module: 'appcompat-v7' } . And gradlew app:dependencies is the command entered at Terminal. You can read about it here - zayn1991

1 answer 1

Source link

Add the library that the studio complains about (asks for com.android.support:customtabs:26.1.0 ), but change its version to yours (28.0.0).

(PS This customtabs library will need as a result 2 more dependencies)

Explanation: You may be confused by the error message because you do not use customtabs, but you have a conflict. Well .. you did not use it directly, but one of your libraries uses the old version of customtabs internally, so you need to request it directly.

As a result, you need to add dependencies:

 implementation 'com.android.support:customtabs:28.0.0' implementation 'com.android.support:support-media-compat:28.0.0' implementation 'com.android.support:support-v4:28.0.0' 

Do not forget to click "Sync" so that Gradle can rebuild the dependency graph and see if there are any more conflicts.

  • Thank. The underlining is gone, but now for some reason it does not compile, now I understand why - Artsait
  • @Artsait What does he write? - zayn1991 4:05