Task 'prepare Release Unit Test Dependencies' not found in project ':app

android
gradle-3297

(Gareth Harding) #1

Hi all,

I’m using Android Stuido but I’m struggling with an error when I try to run my app. The error that occurs is Task ‘prepareReleaseUnitTestDependencies’ not found in project ':app.

I have added the prepare release unit dependencies to the command line compiler under the settings but it hasn’t made a difference?

Any advice?

The code below is from the app gradle.

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
    applicationId "com.example.sjmplanningfinal"
    minSdkVersion 15
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner  "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
    minifyEnabled false
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}


sourceSets {
unitTest {
    java.srcDir file('src/test/java')
    resources.srcDir file('src/test/res')
 }
}

configurations {
unitTestCompile.extendsFrom runtime
unitTestRuntime.extendsFrom unitTestCompile

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-    core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:25.3.1'
testCompile 'junit:junit:4.12'
}