Reputation: 3964
One of third-party libraries used in my project needs recyclerview
package from Android Support library. Since my build.gradle
is set up with compileSdVersion 28
, version 28.0.0 of the library must be used.
The only way for the project to build without errors, I can see so far is listing all dependent packages in build.gradle
:
dependencies {
....
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:asynclayoutinflater:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.android.support:support-core-utils:28.0.0'
implementation 'com.android.support:support-compat:28.0.0'
implementation 'com.android.support:support-core-ui:28.0.0'
implementation 'com.android.support:support-fragment:28.0.0'
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
}
If I omit at least one of the above lines, I get gradle warning: All com.android.support libraries must use exactly same version specification (...). Found versions 28.0.0, 26.1.0
. Then builder gives error because of version clash.
Looking at gradle cache (~/.gradle/modules-2/files-2.1/com.android.support
), I indeed can see both 28.0.0 and 26.1.0 versions. Tried to remove v 26.1.0 from the cache and rebuild with com.android.support
implementation lines, apart from the first one, commented out. Gradle re-downloads v 26.1.0 and I still get the error!
Is there a way to get rid of this nuisance?
Upvotes: 1
Views: 1019
Reputation: 3964
Thanks to Mohsen (I would mark his comment as an answer if I could) I found the culprit.
Version 26.1.0 of Android Support Library is used by Google Play Services Ads.
After upgrade from 16.0.0 to 17.0.0, v26.1.0 of Support Library is still picked up, as you can see for this extract of gradlew app:dependencies
:
+--- com.google.android.gms:play-services-ads:17.0.0
| +--- com.android.support:customtabs:26.1.0 -> 28.0.0
| | +--- com.android.support:support-compat:28.0.0
| | | +--- com.android.support:support-annotations:28.0.0
| | | +--- com.android.support:collections:28.0.0
| | | | \--- com.android.support:support-annotations:28.0.0
| | | +--- android.arch.lifecycle:runtime:1.1.1
| | | | +--- android.arch.lifecycle:common:1.1.1
| | | | | \--- com.android.support:support-annotations:26.1.0 -> 28.0.0
| | | | +--- android.arch.core:common:1.1.1
| | | | | \--- com.android.support:support-annotations:26.1.0 -> 28.0.0
| | | | \--- com.android.support:support-annotations:26.1.0 -> 28.0.0
| | | \--- com.android.support:versionedparcelable:28.0.0
| | | +--- com.android.support:support-annotations:28.0.0
| | | \--- com.android.support:collections:28.0.0 (*)
| | +--- com.android.support:support-annotations:28.0.0
| . . .
| +--- com.google.android.gms:play-services-ads-base:[17.0.0] -> 17.0.0
| +--- com.google.android.gms:play-services-ads-identifier:16.0.0
| | \--- com.google.android.gms:play-services-basement:16.0.1
| | \--- com.android.support:support-v4:26.1.0 -> 28.0.0
. . .
+--- com.google.android.ads.consent:consent-library:1.0.6
| +--- com.google.code.gson:gson:2.8.4
| \--- com.android.support:appcompat-v7:26.1.0 -> 28.0.0
. . .
BTW, As far I understand it, com.android.support:support-annotations:26.1.0
is referred from some support-...:28.0.0
packages. Amazing, isn't it?
Now I reduced the list to five lines and it still builds without errors:
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-annotations:28.0.0'
Will have to wait for the new Admob Ads release, unless someone has a better idea :)
Upvotes: 2