Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.1.0) and test app (23.0.1) differ

后端 未结 9 1279
臣服心动
臣服心动 2020-11-28 21:38

When building I get the following error:

Conflict with dependency \'com.android.support:support-annotations\'. Resolved versions for app (23.1.0) and test a         


        
9条回答
  •  误落风尘
    2020-11-28 22:22

    You can force the annotation library in your test using:

    androidTestCompile 'com.android.support:support-annotations:23.1.0'
    

    Something like this:

      // Force usage of support annotations in the test app, since it is internally used by the runner module.
      androidTestCompile 'com.android.support:support-annotations:23.1.0'
      androidTestCompile 'com.android.support.test:runner:0.4.1'
      androidTestCompile 'com.android.support.test:rules:0.4.1'
      androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
      androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.1'
      androidTestCompile 'com.android.support.test.espresso:espresso-web:2.2.1'
    

    Another solution is to use this in the top level file:

    configurations.all {
        resolutionStrategy.force 'com.android.support:support-annotations:23.1.0'
    }
    

提交回复
热议问题