Android Conflict with dependency appcompat -


i trying add espresso-contrib library project. here build.gradle file :

apply plugin: 'com.android.application'  android {     compilesdkversion 23     buildtoolsversion "23.0.2"      defaultconfig {         applicationid "example.com.littlebox_hari"         minsdkversion 19         targetsdkversion 23         versioncode 1         versionname "1.0"         testinstrumentationrunner "android.support.test.runner.androidjunitrunner"     }     buildtypes {         release {             minifyenabled false             proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro'         }     }     /*configurations.all {         resolutionstrategy {             force 'com.android.support:appcompat-v7:23.4.0'         }     }*/ }   dependencies {     compile filetree(dir: 'libs', include: ['*.jar'])     testcompile 'junit:junit:4.12'     compile 'com.android.support:appcompat-v7:23.4.0'     compile 'com.squareup.retrofit2:retrofit:2.0.0'     compile 'com.squareup.retrofit2:converter-gson:2.0.0'     androidtestcompile 'com.android.support.test:runner:0.4'     androidtestcompile 'com.android.support.test:rules:0.4'     androidtestcompile 'com.android.support.test.espresso:espresso-core:2.2.1'     androidtestcompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'     androidtestcompile 'com.android.support.test.espresso:espresso-core:2.2.1'     androidtestcompile 'com.android.support.test.espresso:espresso-contrib:2.2.2'     androidtestcompile 'com.android.support.test.espresso:espresso-idling-resource:2.2.2'     compile 'com.android.support:support-annotations:23.4.0'     testcompile 'com.android.support:support-annotations:23.4.0'     androidtestcompile 'com.android.support:support-annotations:23.4.0' } 

i error :

error:conflict dependency 'com.android.support:appcompat-v7'. resolved versions app (23.4.0) , test app (23.1.1) differ. see http://g.co/androidstudio/app-test-app-conflict details. 

if uncomment lines in build.gradle file, :

error:(72) error retrieving parent item: no resource found matches given name 'textappearance.appcompat.display1'. error:(75) error retrieving parent item: no resource found matches given name 'textappearance.appcompat.caption'. error:(79) error retrieving parent item: no resource found matches given name 'textappearance.appcompat.caption'. error:(76) error retrieving parent item: no resource found matches given name 'textappearance.appcompat.caption'. error:(82) error retrieving parent item: no resource found matches given name 'textappearance.appcompat.caption'. error:(89) error retrieving parent item: no resource found matches given name 'textappearance.appcompat.button'. d:\littlebox-hari\app\build\intermediates\exploded-aar\com.android.support\design\23.1.1\res\values\values.xml error:(97, 5) no resource found matches given name: attr 'textallcaps'. error:(102, 5) no resource found matches given name: attr 'elevation'. error:(113, 5) no resource found matches given name: attr 'backgroundtint'. error:(113, 5) no resource found matches given name: attr 'elevation'. error:(122, 5) no resource found matches given name: attr 'elevation'. error:(131, 5) no resource found matches given name: attr 'elevation'. 

edit : added following line build.gradle file :

testcompile 'com.android.support:appcompat-v7:23.4.0' androidtestcompile 'com.android.support:appcompat-v7:23.4.0' 

i still same error.

i faced issue today.

first, update dependencies latest versions (0.5 , 2.2.2).

see: https://google.github.io/android-testing-support-library/downloads/

// android junit runner androidtestcompile 'com.android.support.test:runner:0.5'  // junit4 rules androidtestcompile 'com.android.support.test:rules:0.5'  // espresso core androidtestcompile 'com.android.support.test.espresso:espresso-core:2.2.2'  // espresso-contrib datepicker, recyclerview, drawer actions, accessibility checks, countingidlingresource androidtestcompile 'com.android.support.test.espresso:espresso-contrib:2.2.2'  // espresso-web webview support androidtestcompile 'com.android.support.test.espresso:espresso-web:2.2.2'  // espresso-idling-resource synchronization background jobs androidtestcompile 'com.android.support.test.espresso:espresso-idling-resource:2.2.2' 

then, you'll face same error, since latest version isn't still using latest version of support library of (23.4.0). there's issue open on bug tracker already: https://code.google.com/p/android/issues/detail?id=211490

this worked me:

dependencies {     ext {         supportlibversion = '23.4.0'         espressoversion = '2.2.2'     }     compile filetree(dir: 'libs', include: ['*.jar'])     testcompile 'junit:junit:4.12'     androidtestcompile 'com.android.support.test:runner:0.5'     androidtestcompile 'com.android.support.test:rules:0.5'     androidtestcompile "com.android.support.test.espresso:espresso-core:$espressoversion"     androidtestcompile ("com.android.support.test.espresso:espresso-contrib:$espressoversion") {         exclude module: 'recyclerview-v7'         exclude module: 'design'     }     androidtestcompile "com.android.support.test.espresso:espresso-web:$espressoversion"     androidtestcompile "com.android.support.test.espresso:espresso-idling-resource:$espressoversion"     androidtestcompile "com.android.support:support-annotations:$supportlibversion"     compile "com.android.support:appcompat-v7:$supportlibversion"     compile "com.android.support:design:$supportlibversion"     compile "com.android.support:appcompat-v7:$supportlibversion"     compile "com.android.support:recyclerview-v7:$supportlibversion" } 

edit: according codepath guide, seems correct way:

ext {     supportlibversion = '24.1.1'     espressoversion = '2.2.2'     junitversion = '4.12'     mockitoversion = '1.10.19'     hamcrestversion = '1.3'     powermockitoversion = '1.6.5' }  dependencies {     compile filetree(dir: 'libs', include: ['*.jar'])     compile "com.android.support:appcompat-v7:$supportlibversion"     compile "com.android.support:design:$supportlibversion"     compile "com.android.support:recyclerview-v7:$supportlibversion"      // testing dependencies     testcompile "junit:junit:$junitversion"     testcompile "org.mockito:mockito-all:$mockitoversion"     testcompile "org.hamcrest:hamcrest-all:$hamcrestversion"     testcompile "org.powermock:powermock-module-junit4:$powermockitoversion"     testcompile "org.powermock:powermock-api-mockito:$powermockitoversion"     androidtestcompile 'com.android.support.test:runner:0.5'     androidtestcompile 'com.android.support.test:rules:0.5'     androidtestcompile "com.android.support.test.espresso:espresso-core:$espressoversion"     androidtestcompile "com.android.support.test.espresso:espresso-contrib:$espressoversion"     androidtestcompile "com.android.support.test.espresso:espresso-web:$espressoversion"     androidtestcompile "com.android.support.test.espresso:espresso-idling-resource:$espressoversion" }  configurations.all {     resolutionstrategy.force "com.android.support:support-annotations:$supportlibversion" }  configurations.compile.dependencies.each { compiledependency ->     println "excluding compile dependency: ${compiledependency.getname()}"     configurations.androidtestcompile.dependencies.each { androidtestcompiledependency ->     configurations.androidtestcompile.exclude module: "${compiledependency.getname()}" } 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -