Cannot build project

Viewed 5058

I trying to assemble my project, but I only get an error:

Error:Execution failed for task ':basetools:processDebugAndroidTestResources'.
> No slave process to process jobs, aborting

I didn't change anything in my gradle files but abruptly got this error.

I already tried invalidate cahces and restart, rebuild

What should I do to fix it?

This is my project's build.gradle

buildscript {
    ext.kotlin_version = '1.1.51'
    apply from: 'scripts/dependencies.gradle'
    apply from: 'scripts/testDependencies.gradle'
    repositories {
        google()
        mavenLocal()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
        maven {
            url "https://maven.google.com"
        }
        maven { url 'https://jitpack.io' }
    }
    dependencies {
        classpath plugin.android
        classpath plugin.fabric
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.1.0'
    }
}

allprojects {
    repositories {
        google()
        mavenLocal()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
        maven {
            url "https://maven.google.com"
        }
        maven { url 'https://jitpack.io' }
    }
    gradle.projectsEvaluated {
        tasks.withType(JavaCompile) {
            options.compilerArgs << "-Xmaxerrs" << "1000" // or whatever number you want
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

This is a build.project of app

apply plugin: 'com.android.application'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.fabric'

def mainKeystore = file("../main.keystore")
//def debugKeystore = file("../debug.keystore")

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId "com.ilyinp.valutetracker"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 2
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true
    }

    signingConfigs {
        release {
            storeFile mainKeystore
            keyAlias "valutetracker"
        }
    }

    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }

    dataBinding {
        enabled = true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
        incremental = false
    }
}

kapt {
    generateStubs = true
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.google.firebase:firebase-core:11.6.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    compile project(base.baseTools)
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    kapt "com.android.databinding:compiler:3.0.0"

    compile dep.dagger.lib
    kapt dep.dagger.apt

    compile dep.moxy.lib
    compile dep.moxy.appCompat
    kapt dep.moxy.apt

    compile(dep.crashlytics) {
        transitive = true
    }
    compile 'com.google.android.gms:play-services-ads:11.6.0'
}

apply plugin: 'com.google.gms.google-services'

And finally, build.gradle of module basetools

apply plugin: 'com.android.library'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'


    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dataBinding {
        enabled = true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

kapt {
    generateStubs = true
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:26.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile dep.support.multiDex
    //    compile dep.support.appCompat
    compile dep.support.cardView
    compile dep.support.recyclerView
    compile dep.support.design
    compile dep.support.constraintLayout
    compile dep.glide.lib
    compile dep.glide.transformations
    compile dep.rxjava.lib
    compile dep.rxjava.android
    compile dep.rxjava.permissions
    compile dep.rxjava.binding
    compile dep.rxjava.bindingCompat
    compile dep.retrofit.lib
    compile dep.retrofit.converter.gson
    compile dep.retrofit.adapter.rxjava
    compile dep.okhttp.lib
    compile dep.okhttp.interceptor.logging
    compile dep.dagger.lib
    kapt dep.dagger.apt
    compile dep.timber
    compile dep.moxy.lib
    compile dep.moxy.appCompat
    kapt dep.moxy.apt
    compile dep.materialDialogs
    compile dep.parceler.lib
    kapt dep.parceler.apt
    compile dep.cicerone
    compile(dep.fastadapter) {
        transitive = true
    }
    compile(dep.fastadapterCommons)
    compile(dep.fastadapterExtensions)
    compile(dep.materialize) {
        transitive = true
    }
    compile(dep.crashlytics) {
        transitive = true
    }
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    kapt "com.android.databinding:compiler:3.0.0"
}
repositories {
    mavenCentral()
}
8 Answers

Go to Android Studio, click "File" and click "Invalidate Caches / Restart...". This will work.

change

minifyEnabled true

to

minifyEnabled false

if above changes does not work then try this as well

shrinkResources true

to

shrinkResources false

Same issue. Invalidate caches and restart done the job for me.

You can delete build folder in project and modules. After Invalidate Caches and Restart , it work for me!

You can try it

  1. Delete build folder manually (project's build and modules' build)

  2. Delete old .impl file

  3. Restart Android Studio

I was going through some RnD and applied above nothing worked, rather that made my project to crash completely and re do. I was not shutting down and restart the system everyday. When I got the next time I simply didn't do anything but restarted the system. It worked fine!!..

Guys , keep in mind : Invalidate Caches and Restart will make you loose complete history of code changes.

shrinkResources to false / minifyEnabled to false will cost you few kbs of apk size

Related