I'm trying to resolve two errors:
To run integration tests in my Android Studio project. To solve this, I've seen some answers and my build.gradle looks like:
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 solve both errors, but a warning appears:
Error:Conflict with dependency 'junit:junit' in project ':app'. Resolved versions for app (4.11) and test app (4.12) differ.
Thanks!
One solution is to force Gradle to compile junit:junit:4.11
instead of junit:junit:4.12
To do that, in your app's build.gradle
, add the following:
android {
configurations.all {
resolutionStrategy.force 'junit:junit:4.11'
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With