I am really confused as to why this overwrite is not working.
I made a project by robotium record .when I sync this project ,android studio told me an error log as following.
Gradle 'EpayAppTest' project refresh failed
Error:Cannot add task ':EpayAppTest:assembleDebug' as a task with that name already exists.
Is there anything wrong with my build.gradle ,whitch is generated by Robotium Recorder.
buildscript {
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
}
}
apply plugin: 'com.android.application'
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}
dependencies {
androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.6.1'
testCompile 'junit:junit:4.12'
}
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
android {
defaultConfig {
minSdkVersion 14
}
lintOptions {
abortOnError false
}
sourceSets
{
androidTest
{
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
buildTypes {
release {
proguardFile getDefaultProguardFile('proguard-android.txt')
}
}
}
task assembleDebug( overwrite: true) {}
task copyTask(type: Copy) {
from 'E:/work/app-qa-debug-withTest_debug.apk'
into 'build/outputs/apk/'
rename {
'EpayAppTest-debug.apk'
}
}
assembleDebug.dependsOn copyTask
Try bringing the following to the top of the script, see if that works...