2

I have been having errors with sdk compatibilty. here is my code

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
        defaultConfig {
        applicationId "com.capstone.katugna"
        minSdkVersion 23
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner         
    "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'),             
    'proguard-rules.pro'
        }
        packagingOptions {
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/LICENSE-FIREBASE.txt'
            exclude 'META-INF/NOTICE'
        }
    }
    productFlavors {
    }
    }

    dependencies {
        implementation fileTree(include: ['*.jar'], dir: 'libs')
        implementation 'com.android.support:appcompat-v7:27.1.1'
        implementation 'com.android.support:support-media-compat:27.1.1'
        implementation 'com.android.support:support-v4:27.1.1'
        implementation 'com.android.support.constraint:constraint-layout:1.1.2'
        implementation 'com.android.support:support-annotations:27.1.1'
        implementation 'com.google.firebase:firebase-core:16.0.1'
        implementation 'com.google.firebase:firebase-database:16.0.1'
        implementation 'com.google.firebase:firebase-auth:16.0.2'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-                core:3.0.2'
    }


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

I have been getting errors in the implementation 'com.android.support:appcompat-v7:27.1.1'. It is suggesting Examples include com.android.support:animated-vector-drawable:27.1.1 and com.android.support:support-v4:26.1.0

here is my build gradle project

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
        classpath 'com.google.gms:google-services:4.0.1'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
  • add your build.gradle project – Pavneet_Singh Oct 03 '18 at 05:45
  • 'buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.1.4' classpath 'com.google.gms:google-services:4.0.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() google() } } task clean(type: Delete) { delete rootProject.buildDir } ' – Rona Cecilia Abayata Oct 03 '18 at 05:46
  • https://stackoverflow.com/questions/42374151/all-com-android-support-libraries-must-use-the-exact-same-version-specification – Pavneet_Singh Oct 03 '18 at 05:48
  • Possible duplicate of [All com.android.support libraries must use the exact same version specification](https://stackoverflow.com/questions/42374151/all-com-android-support-libraries-must-use-the-exact-same-version-specification) – Pavneet_Singh Oct 03 '18 at 05:49

2 Answers2

2

Version conflict occurring due to multiple transitive dependencies are pulled from different api/libs, you might need to force the resolution strategy in the module gradle as

configurations.all {
    resolutionStrategy.force 'com.android.support:support-annotations:27.1.1'
}

Along with above, have the mentioned dependencies explicitly in the gradle as

implementation 'com.android.support:animated-vector-drawable:27.1.1'
implementation 'com.android.support:support-compat:27.1.1'
Rizwan
  • 2,369
  • 22
  • 27
0

I had the same problem and I had to add the next 2 libraries to dependencies in Gradle. I don't know why it works, but it works.

implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
Alvaro
  • 286
  • 3
  • 15