![](/img/trans.png)
[英]Error:Conflict with dependency 'com.android.support:support-v4' in project ':app'. Resolved versions for app (25.3.1) and test app (23.1.1) differ
[英]Espresso Error:Conflict with dependency 'com.android.support:support-v4'. Resolved versions for app (24.2.0) and test app (23.1.1) differ
我已經升級到最新的API級別24,這是最新的API級別(在發生問題時),無論如何它都會導致此錯誤消息。
錯誤:與依賴項“ com.android.support:support-v4”沖突。 應用(24.2.0)和測試應用(23.1.1)的已解決版本不同。 有關詳情,請參見http://g.co/androidstudio/app-test-app-conflict 。
那么我該如何解決呢?
同樣, 此頁面的第二答案給出了解決該問題的方法,但是如果您要在您的計算機中包含com.android.support.test.espresso:espresso-contrib:2.2.2
,那么這將導致出現4條類似的錯誤消息。
那么,如何擺脫這4條額外的錯誤消息呢?
這是我的Espresso build.gradle依賴項:
androidTestCompile "com.android.support:support-annotations:$SUPPORT_VERSION"
androidTestCompile "com.android.support.test.espresso:espresso-core:$ESPRESSO_VERSION"
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile "com.android.support.test.espresso:espresso-intents:$ESPRESSO_VERSION"
/**
* AccessibilityChecks
* CountingIdlingResource
* DrawerActions
* DrawerMatchers
* PickerActions (Time and Date picker)
* RecyclerViewActions
*/
androidTestCompile("com.android.support.test.espresso:espresso-contrib:$ESPRESSO_VERSION") {
exclude group: 'com.android.support', module: 'appcompat'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'support-v7'
exclude group: 'com.android.support', module: 'design'
exclude module: 'support-annotations'
exclude module: 'recyclerview-v7'
}
哪里:
ESPRESSO_VERSION = '2.2.2'
如果仍然卡住,請檢查我項目的build.gradle
文件: https : //github.com/piotrek1543/LocalWeather/blob/master/app/build.gradle
希望對你有幫助
我找到了解決方法(解決方法),如果您單擊下面的圖片,您將注意到下面的圖片,您將注意到錯誤消息
錯誤:與依賴項“ com.android.support:support-v4”沖突。 應用(24.2.0)和測試應用(23.1.1)的已解決版本不同。 有關詳情,請參見http://g.co/androidstudio/app-test-app-conflict 。
用線固定
configurations.all {resolutionStrategy.force "com.android.support:support-v4:23.1.0"}
它位於gradle文件的依賴項區域中
同樣的錯誤信息
錯誤:與依賴項“ com.android.support:appcompat-v7”沖突。 應用(24.2.0)和測試應用(23.1.0)的已解決版本不同。 有關詳情,請參見http://g.co/androidstudio/app-test-app-conflict 。
可以用線固定
configurations.all {resolutionStrategy.force "com.android.support:appcompat-v7:23.1.0"}
類推,直到解決所有錯誤為止ps不要忘了在這里找到主要解決方案(第二和第三答案向下
您可以使用以下命令在測試中強制使用支持庫:
androidTestCompile 'com.android.support:support-v4:24.2.0'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.