Tobias Reich Tobias Reich - 25 days ago 6
Android Question

Warning:Conflict with dependency 'com.android.support:support-annotations' (25.0.1)

Okay, I know, a similar question has been asked several times but I can't find a solution for my problem.
I need to test my application. So I followed a tutorial telling me to add Android runnter support.

androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'


Problem is, this doesn't seem to be compatible with my compat libraries.

compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:design:25.0.1'


But these libraries are needed since we develop against API level 25. So going back to version 23 is not an option I guess.

So how can I get this running? Am I missing something?

Answer
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'

refer to older version of supportAnnotations:

com.android.support:support-annotations:23.1.1

You have a few choices:

  1. Specifically declare suportAnnotations version for test compilation (to override any transitive dependencies):

    androidTestCompile 'com.android.support:support-annotations:25.0.1'
    
  2. Exlude it from those dependencies:

    androidTestCompile ('com.android.support.test:runner:0.5') {
        exclude module: 'support-annotations'
    }
    androidTestCompile ('com.android.support.test:rules:0.5') {
        exclude module: 'support-annotations'
    }