-1

I am completely new to android and kotlin programming. I just started learning android since yesterday. I have successfully created a project but it doesn't show me xml editor.

Error:Execution failed for task ':app:preDebugAndroidTestBuild'. Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.

build.gradle

buildscript {
    ext.kotlin_version = '1.1.51'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

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

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

task clean(type: Delete) {
    delete rootProject.buildDir
}

Any idea to solve this problem

Chris Hadfield
  • 494
  • 1
  • 7
  • 34

2 Answers2

0

In Android Studio , click on Terminal and execute this command.

gradlew app:dependencies and then search for com.android.support:support-annotations. Then in your app level gradle file , exculude the com.android.support:support-annotations dependency from the dependency which has the older version i.e 26.1.0. To learn how to exuclude go here.

Dishonered
  • 8,449
  • 9
  • 37
  • 50
0
    configurations.all {
resolutionStrategy {
force 'com.android.support:support-annotations:26.1.0'
}
}

Add the above line in your app.gradle file before dependencies block & replace compile to implementation.

Bhupat Bheda
  • 1,968
  • 1
  • 8
  • 13