首页 > 解决方案 > 任务 ':app:javaPreCompileDebug' 执行失败。> 执行任务 ':app:javaPreCompileDebug' 时取消构建

问题描述

构建输出的详细信息:

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:javaPreCompileDebug'.
> Build cancelled while executing task ':app:javaPreCompileDebug'

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Build cancelled while executing task ':app:processDebugResources'

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 7s
12 actionable tasks: 6 executed, 6 up-to-date

build.gradle(:app)


apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.btp.classroom"
        minSdkVersion 19
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.20"

    //noinspection GradleCompatible
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'

    implementation 'com.google.android.material:material:1.2.1' //1

    implementation 'androidx.legacy:legacy-support-v4:1.0.0' //2

    implementation 'com.google.firebase:firebase-auth:20.0.1'
    implementation 'com.google.firebase:firebase-database:19.5.1'
    implementation 'com.google.firebase:firebase-storage:19.2.0'
    implementation 'com.firebaseui:firebase-ui-database:4.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    implementation 'com.github.bumptech.glide:glide:4.8.0'
    implementation 'com.google.code.gson:gson:2.8.6'
    implementation 'com.google.firebase:firebase-core:18.0.0'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
}

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

标签: androidandroid-studiogradle

解决方案


尝试在顶部编译 gradle:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

还要删除底部的这个插件(为什么它还在那里?所有插件都在顶部)

这也看起来像插件的未完成实现:

com.google.gms.google-services

推荐阅读