I am following an older tutorial on PluralSight: Enhancing the Android Application Experience. Since I am using a newer version of the IDE I have been running into some issues. Most I can fix here at SO but I am stuck and have not enough experience beyond what I know.
In setting up some unit tests I had to add androidTestImplementation ('com.android.support.test.espresso:espresso-contrib:3.0.2' to the gradle file. The instructor eluded to this creating some issues since
The espresso-contrib library is actually relying on different versions of certain classes than we are using in our application. Cause remember that gradle takes care of resolving down chain dependencies
The errors experience in the module were not the ones I was getting below. They were fixed by adding explicit calls to the libraries in the TestCompile. Me doing the same thing doesn't address the problem.
Cannot find a version of 'com.android.support:appcompat-v7' that satisfies the version constraints:
Dependency path 'NoteKeeper:app:unspecified' --> 'com.android.support:appcompat-v7:24.2.1'
Constraint path 'NoteKeeper:app:unspecified' --> 'com.android.support:appcompat-v7:{strictly 24.2.1}' because of the following reason: debugRuntimeClasspath uses version 24.2.1
Dependency path 'NoteKeeper:app:unspecified' --> 'com.android.support:appcompat-v7:24.2.1'
Dependency path 'NoteKeeper:app:unspecified' --> 'com.android.support:appcompat-v7:24.2.1'
Constraint path 'NoteKeeper:app:unspecified' --> 'com.android.support:appcompat-v7:{strictly 24.2.1}' because of the following reason: debugRuntimeClasspath uses version 24.2.1
Dependency path 'NoteKeeper:app:unspecified' --> 'com.android.support:appcompat-v7:24.2.1'
Dependency path 'NoteKeeper:app:unspecified' --> 'com.android.support:appcompat-v7:24.2.1'
Constraint path 'NoteKeeper:app:unspecified' --> 'com.android.support:appcompat-v7:{strictly 24.2.1}' because of the following reason: debugRuntimeClasspath uses version 24.2.1
Dependency path 'NoteKeeper:app:unspecified' --> 'com.android.support:appcompat-v7:24.2.1'
Dependency path 'NoteKeeper:app:unspecified' --> 'com.android.support:appcompat-v7:24.2.1'
Constraint path 'NoteKeeper:app:unspecified' --> 'com.android.support:appcompat-v7:{strictly 24.2.1}' because of the following reason: debugRuntimeClasspath uses version 24.2.1
Dependency path 'NoteKeeper:app:unspecified' --> 'com.android.support:appcompat-v7:24.2.1'
Dependency path 'NoteKeeper:app:unspecified' --> 'com.android.support:appcompat-v7:24.2.1'
Constraint path 'NoteKeeper:app:unspecified' --> 'com.android.support:appcompat-v7:{strictly 24.2.1}' because of the following reason: debugRuntimeClasspath uses version 24.2.1
Dependency path 'NoteKeeper:app:unspecified' --> 'com.android.support:appcompat-v7:24.2.1'
Dependency path 'NoteKeeper:app:unspecified' --> 'com.android.support:appcompat-v7:24.2.1'
Constraint path 'NoteKeeper:app:unspecified' --> 'com.android.support:appcompat-v7:{strictly 24.2.1}' because of the following reason: debugRuntimeClasspath uses version 24.2.1
Dependency path 'NoteKeeper:app:unspecified' --> 'com.android.support:appcompat-v7:24.2.1'
Dependency path 'NoteKeeper:app:unspecified' --> 'com.android.support:design:27.1.1' --> 'com.android.support:appcompat-v7:27.1.1'
Dependency path 'NoteKeeper:app:unspecified' --> 'com.android.support:appcompat-v7:24.2.1'
Constraint path 'NoteKeeper:app:unspecified' --> 'com.android.support:appcompat-v7:{strictly 24.2.1}' because of the following reason: debugRuntimeClasspath uses version 24.2.1
Dependency path 'NoteKeeper:app:unspecified' --> 'com.android.support:appcompat-v7:24.2.1'
Dependency path 'NoteKeeper:app:unspecified' --> 'com.android.support:appcompat-v7:24.2.1'
Constraint path 'NoteKeeper:app:unspecified' --> 'com.android.support:appcompat-v7:{strictly 24.2.1}' because of the following reason: debugRuntimeClasspath uses version 24.2.1
Dependency path 'NoteKeeper:app:unspecified' --> 'com.android.support:appcompat-v7:24.2.1'
My app gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
defaultConfig {
applicationId "com.jwhh.jim.notekeeper"
minSdkVersion 24
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.android.support:appcompat-v7:24.2.1'
implementation 'com.android.support:design:24.2.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:recyclerview-v7:24.2.1'
implementation 'com.android.support:cardview-v7:24.2.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation ('com.android.support.test.espresso:espresso-core:3.0.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.2'
androidTestImplementation 'com.android.support:appcompat-v7:24.2.1'
androidTestImplementation 'com.android.support:design:24.2.1'
androidTestImplementation 'com.android.support:cardview-v7:24.2.1'
}
I looked around for solutions here but didn't find anything that fit.
Resources error when I add espresso-contrib talked about changing the SDK version. Everything I have done was to match 24 so I don't think changing that will make things better. Perhaps I am using the wrong espresso builds?
Espresso test aren't running after adding espresso-contrib library in gradle suggests that I need to add some exclusions which I tried as follows with no obvious difference. Also, not entirely sure what this is suppose to do.
androidTestImplementation ('com.android.support.test.espresso:espresso-contrib:3.0.2', {
exclude group: 'com.android.support', module: 'appcompat'
exclude group: 'com.android.support', module: 'support-v4'
exclude module: 'recyclerview-v7'
})
I poked around the Espresso Setup but got lost and found no caveats when it came to espresso-contrib
from Adding espresso-contrib to androidTestImplementation creates dependancy / constraint errors
Thanks for Sharing This Article. It was a valuable content. I hope these Commenting lists will help to my website.
ReplyDeleteAmazon web services Training in chennai
Amazon web services Course in chennai