无法建立项目

时间:2017-11-12 16:37:51

标签: android gradle

我试图组装我的项目,但我只收到错误:

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

我没有更改gradle文件中的任何内容但突然出现此错误。

我已尝试使用invalidate cahces并重新启动,重建

我该怎么办才能修复它?

这是我的项目的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
}

这是app的build.project

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'

最后,模块basetools的build.gradle

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 个答案:

答案 0 :(得分:6)

转到Android Studio,单击“文件”,然后单击“使缓存无效/重新启动...”。这将有效。

答案 1 :(得分:2)

更改

minifyEnabled true

minifyEnabled false

如果上述更改无效,请尝试以下

shrinkResources true

shrinkResources false

答案 2 :(得分:1)

重新启动Android Studio不足以为我解决此错误:我还必须杀死一个留下的aapt2进程。

答案 3 :(得分:1)

同样的问题。使高速缓存无效并重新启动为我完成了这项工作。

答案 4 :(得分:0)

&#39;清洁项目&#39;,&#39;重建项目&#39;我没有工作。我通过无效并重新启动

解决了这个问题

答案 5 :(得分:0)

  1. 手动删除构建文件夹(项目构建和模块&#39;构建)

  2. 删除旧的.impl文件

  3. 重启Android Studio

答案 6 :(得分:0)

我正在经历一些RnD并在上面应用没有任何工作,而是让我的项目完全崩溃并重新做。 我没有关机,每天都要重启系统。 当我下次我只是没有做任何事情,只有重新启动系统。它工作得很好!! ..

伙计们,请记住:使缓存无效并重新启动将使您完整地删除代码更改历史记录。

shrinkResources 为false / minifyEnabled 为false会花费你几kbs的apk大小

答案 7 :(得分:0)

您可以删除项目和模块中的构建文件夹使缓存无效并重新启动后,它对我有用!

您可以尝试