(org.gradle.api.tasks.TaskExecutionException:任务':app:compileDebugJavaWithJavac')执行失败,同时使用firebase

时间:2018-06-08 07:40:29

标签: java android firebase gradle

我正在开发一个聊天应用程序,我想使用较旧的依赖项,但在使用它时我遇到了这些问题

错误

  

org.gradle.api.tasks.TaskExecutionException:任务':app:compileDebugJavaWithJavac'执行失败。       at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)       在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)       在org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)       在org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)       在org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)       在org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)   org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)       ... 107更多

Gradle文件

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.google.firebase:firebase-auth:10.2.0'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.google.firebase:firebase-database:10.2.0'
    implementation 'com.google.firebase:firebase-storage:10.2.0'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.4.+'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.firebaseui:firebase-ui-database:1.2.0'
    implementation 'com.squareup.okhttp:okhttp:2.5.0'
    implementation 'id.zelory:compressor:2.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
    implementation 'de.hdodenhof:circleimageview:2.1.0'

}

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

1 个答案:

答案 0 :(得分:0)

尝试更新依赖项:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.google.firebase:firebase-auth:16.0.1'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'com.google.firebase:firebase-storage:16.0.1'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.firebaseui:firebase-ui-database:1.2.0'
    implementation 'com.squareup.okhttp:okhttp:2.7.2'
    implementation 'id.zelory:compressor:2.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
}

另请确保使用最新版本的Google服务,例如:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
        classpath 'com.google.gms:google-services:4.0.1'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}