Abdenaceur Lichiheb Abdenaceur Lichiheb - 1 month ago 32
Android Question

Android : Gradle build failed

After updating android studio, I tried to run a project, but it show me an error because of some dependency error, saying that there is a Conflict with dependency 'com.android.support:support-annotations'.

This my build.gradle file

apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion '24.0.3'
defaultConfig {
applicationId "com.example.abdelnacer.parentooandroid"
minSdkVersion 21
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}


repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.+'
compile 'com.parse:parsefacebookutils-v4-android:1.10.4@aar'
compile 'com.parse:parseui-widget-android:0.0.1'
compile 'com.facebook.android:facebook-android-sdk:4.+'
testCompile 'org.mockito:mockito-core:1.+'
testCompile 'org.robolectric:robolectric:3.2-SNAPSHOT'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.2'
androidTestCompile 'com.android.support:support-annotations:24.2.1'
compile 'com.google.guava:guava:19.0'
compile 'com.google.android.gms:play-services:9.2.0'
compile 'com.google.android.gms:play-services-location:9.2.0'
compile 'org.apache.commons:commons-io:1.3.2'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.wefika:flowlayout:0.4.1'
compile 'com.facebook.shimmer:shimmer:0.1.0@aar'
compile 'com.github.armcha:LuseenBottomNavigation:1.8.2'
}


and the error

Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]
Warning:Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (25.0.0) and test app (24.2.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
Error:Execution failed for task ':app:prepareDebugAndroidTestDependencies'.
> Dependency Error. See console for details.


I really can't figure out what's the problem?

Answer

add:

 androidTestCompile "com.android.support:support-annotations:25.0.0"