Issue
I am trying to set up an Instrumented Unit Tests for my App. and I have added dependency based on the below developer site link.
https://developer.android.com/training/testing/unit-testing/instrumented-unit-tests.html#build
This is my dependency list
dependencies {
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:support-v4:21.0.3'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
androidTestCompile 'com.android.support:support-annotations:24.0.0'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
}
When I build the project I am getting the below compile error:
Error:Conflict with dependency 'com.android.support:support-annotations' in project ':MyApp'. Resolved versions for the app (21.0.3) and test app (24.0.0) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
Could anyone please help me to resolve this issue.
Solution
Annotations is the part of Support library. So,your annotations and support library version Should be same and you have to call forcefully by using below code .This code should be placed above dependencies.For more detail See here
configurations.all {
resolutionStrategy {
force 'com.android.support:support-annotations:21.0.3'
}
}
Answered By - PRIYA PARASHAR
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.