5

I have been trying to bring back an old app of mine, that I wrote a while back using eclipse. I imported to android-studio and I it complains about colliding versions:

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0-alpha1, 27.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0-alpha1 and com.android.support:cardview-v7:27.1.0

At first, I solved it as suggested by this question, by including the colliding packages specifically in the gradle file with the newer version. So my gradle file ended up like this:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.3"

    defaultConfig {
        applicationId "com.tomklino.imhere"
        minSdkVersion 16
        targetSdkVersion 19
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }


    dependencies {
        implementation 'com.android.support:appcompat-v7:+'
        implementation 'com.android.support:cardview-v7:27.1.0'
        implementation 'com.android.support:customtabs:27.1.0'
        implementation 'com.android.support:support-media-compat:27.1.0'
        implementation 'com.android.support:support-v4:27.1.0'
        implementation 'com.loopj.android:android-async-http:1.4.9'
        implementation "com.google.android.gms:play-services-gcm:11.8.0"
        implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
    }

    apply plugin: 'com.google.gms.google-services'
}

This removed the red line from under the appcompat line, but then, after debugging something else, I got the message above again, but this time with the version 28.0.0-alpha1. Now I can't include the new version, because if I try it says it is incompatible with the sdk version of 27.

I'm trying to understand why it asks for that version in the first place if I havn't included that sdk version anywhere. Nothing in the dependency tree asks for the 28.0.0-alpha1 version specifically.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Tom Klino
  • 2,358
  • 5
  • 35
  • 60

2 Answers2

4

but then, after debugging something else, I got the message above again, but this time with the version 28.0.0-alpha1

Replace:

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

with:

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

and resolve to stop using + for the entire version of an artifact.

I'm trying to understand why it asks for that version in the first place if I havn't included that sdk version anywhere.

You used + for the version of appcompat-v7. This says that you want the latest that Gradle can find. And, last week, Google released 28.0.0-alpha1, in tandem with the release of the Android P Developer Preview 1.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • I have no dependencies with + but i still have the problem – porfirion Mar 13 '18 at 11:30
  • @porfirion: You may want to ask a separate Stack Overflow question, where you provide a [mcve] showing your error and the files triggering the error (e.g., `app/build.gradle`). – CommonsWare Mar 13 '18 at 12:28
0

I had the same issue, but no of dependencies had '+' in version number. Problem was in xwalk (Crosswalk WebView) library. I've solved it by adding 'transitive':

compile ('org.xwalk:xwalk_core_library:23.53.589.4') {
    transitive = true;
}
porfirion
  • 1,619
  • 1
  • 16
  • 23