2

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?

Tobias Reich
  • 4,952
  • 3
  • 47
  • 90
  • 2
    Check this out: http://stackoverflow.com/questions/28999124/resolved-versions-for-app-22-0-0-and-test-app-21-0-3-differ – Marcin Kunert Nov 15 '16 at 15:04
  • Thanks for the link but this was about an older version. The test runner is compatible until v.23 but I'm not sure what to do with my project with API level 25. – Tobias Reich Nov 15 '16 at 15:13

1 Answers1

3
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'
    }
    
R. Zagórski
  • 20,020
  • 5
  • 65
  • 90