Warning: conflict with dependency "junit: junit" in project "application". Resolved versions for app (4.11) and test app (4.12)
I am trying to resolve two errors:
- Cannot resolve symbol 'test'
- Cannot resolve symbol "AndroidJUnit4"
Running integration tests in my Android Studio project. To solve this problem I've seen several answers and my build.gradle looks like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.ps.comunio.comuniops"
minSdkVersion 15
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'
}
debug {
debuggable true
}
}
compileOptions.with {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}
lintOptions {
abortOnError false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.11'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'info.cukes:cucumber-java:1.2.0'
compile 'info.cukes:cucumber-junit:1.2.0'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
}
This will resolve both errors, but a warning appears:
Error: Conflict with dependency "junit: junit" in project "application". The allowed versions for apps (4.11) and test app (4.12) are different.
Thank!
+3
source to share
3 answers