0

To change the target SDK to 28, I did the following in build.gradle:

android {
      compileSdkVersion 28

      defaultConfig {
        targetSdkVersion 28

   ...
      dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.android.support:appcompat-v7:28.0.0' //-- line with error
implementation 'com.android.support:design:28.0.0' //-- line with error
implementation 'com.android.support:support-annotations:28.0.0'

implementation 'com.squareup.okhttp3:okhttp:3.9.1'
implementation "com.google.code.gson:gson:2.8.2"
implementation files('libs/commons-io-2.4.jar')
implementation files('libs/WebtrendsAndroidClientLib.jar')

// Urban Airship  -- Start
api 'com.urbanairship.android:urbanairship-sdk:9.0.0'

// Recommended for in-app messages
implementation 'com.android.support:cardview-v7:28.0.0' //-- line with error

// We need to add these to force Urban AirShip and Google play services to use latest version.
implementation 'com.android.support:animated-vector-drawable:28.0.0' //-- line with error
implementation 'com.android.support:mediarouter-v7:28.0.0' //-- line with error

implementation "com.google.android.gms:play-services:11.8.0"

// Urban Airship  -- End

//-- third party lib
implementation 'com.github.barteksc:android-pdf-viewer:2.4.0'
implementation 'com.sothree.slidinguppanel:library:3.3.0'
implementation 'com.google.maps.android:android-maps-utils:0.5+'

//api 'at.favre.lib', name: 'bytes', version: '0.2.0'
api 'at.favre.lib:bytes:0.2.0'

implementation 'com.android.support.constraint:constraint-layout:1.1.3'

}

But in Android Studio IDE, it shows error for line:

     com.android.support:appcompat-v7:28.0.0

and the description:

enter image description here

If I comment this line, the next line which has "28.0.0" will have same error. So it seems like none of those with "28.0.0" is in effect at all.

What I have done incorrectly?

Not

updated with full contents in "dependencies" and marked each implementation that will have error. each error is exactly the same one as the description in the image

BTW, tried the solution in this url: All com.android.support libraries must use the exact same version specification but it doesn't work for me at all and same error happens.

** Note on Note **: The solution in the url: All com.android.support libraries must use the exact same version specification does work. You need to "Sync" the project.

Thanks,

Shawn

Shawn
  • 530
  • 1
  • 5
  • 15
  • It is possible that you are depending on something that itself depends on `support-v4:25.2.0`. Have you checked your transitive dependencies? – Ben P. Sep 26 '19 at 21:34
  • For instance, if you depend on an open-source library that generates rounded `ImageView`s or something like that, the library itself could have the dependency on the old version of the support library. – Ben P. Sep 26 '19 at 21:35
  • @Ben, how to check transitive dependencies? I updated the full contents of "dependencies". Thanks. – Shawn Sep 27 '19 at 16:55

2 Answers2

2

edit use this in your dependencies

implementation 'com,android.support:support-v4:28.0.0'

try this and let me know if solved the problem.

SumOn
  • 306
  • 1
  • 4
  • same error. According to the error message in the image, it say: All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes.) Found version 28.0.0, 25.2.0. Examples include com.android.support:animated-vector-drawable:28.0.0 and com,android.support:support-v4:25.2.0 ... but I couldn't find 25.2.0 at all. – Shawn Sep 26 '19 at 21:03
  • sorry I made a mistake. Edited the answer. try it and let me know. – SumOn Sep 26 '19 at 21:14
  • adding this implementation 'com.android.support:support-v4:28.0.0' does work. I need to "Sync" to make it work. Thanks! – Shawn Sep 27 '19 at 17:09
0

This warning indicates that you are using versions of libraries that may collide and cause some runtime problems. This is not an error though - you still can build and run the project - it may misbehave in certain conditions though.

To eliminate warning you have to update all the google libraries you have to the same version.

As I can see from the question - you've already did it. There is one problem though - other libraries you are using, might be done not very thoroughly(or it is their nature) and they are leaking their inner google libraries dependencies. And they most definitely are since this warning retains after you've changed all the explicit ones in your gradle.

You have several options to deal with this error

  • Try to update all the third party libraries to the newest versions - maybe their developers updated them already
  • Figure out which library causes this warning to appear and either update it, delete it or changed it to similar one that is compliant with current target API of your app.
  • Use
{
    transitive = false;
}

for the library that causes disruptions and maybe, if the library is well crafted, warning will disappear and your code will remain its working state. (Highly unlikely)

  • The last option is not to care too much. Usually I use this option. Never have I ever experience troubles from it.

Hope it helps.

Pavlo Ostasha
  • 14,527
  • 11
  • 35