Execution failed for task ':app:compileDebugJavaWithJavac' Android Studio 3.1 Update

后端 未结 13 831
广开言路
广开言路 2020-12-08 06:44

I am getting error after updating the version of Android Studio 3.1 Canary 6

I don\'t why its happen, before that it\'s running successfully.

<
相关标签:
13条回答
  • 2020-12-08 06:50

    Go to preferences(settings) : click on Build,Execution,Deployment .....then select : Instant Run ......and uncheck its topmost checkbox (i.e Disable Instant Run)

    0 讨论(0)
  • 2020-12-08 06:50

    This problem is commonly related to compiler errors in the Java code. Sometimes Android Studio does not show these errors in the Project explorer. However, when a problematic .java file is opened, errors are shown. Try to resolve errors and rebuild the project.

    0 讨论(0)
  • 2020-12-08 06:52

    Just solve the problem which come from java compiler instead of Build-Run task

    0 讨论(0)
  • 2020-12-08 06:54

    I found the solution as Its problem with Android Studio 3.1 Canary 6

    My backup of Android Studio 3.1 Canary 5 is useful to me and saved my half day.

    Now My build.gradle:

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 27
        buildToolsVersion '27.0.2'
        defaultConfig {
            applicationId "com.example.demo"
            minSdkVersion 15
            targetSdkVersion 27
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            vectorDrawables.useSupportLibrary = true
        }
        dataBinding {
            enabled true
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
        productFlavors {
        }
    }
    
    dependencies {
        implementation fileTree(include: ['*.jar'], dir: 'libs')
        implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
        implementation "com.android.support:design:${rootProject.ext.supportLibVersion}"
        implementation "com.android.support:support-v4:${rootProject.ext.supportLibVersion}"
        implementation "com.android.support:recyclerview-v7:${rootProject.ext.supportLibVersion}"
        implementation "com.android.support:cardview-v7:${rootProject.ext.supportLibVersion}"
        implementation "com.squareup.retrofit2:retrofit:2.3.0"
        implementation "com.google.code.gson:gson:2.8.2"
        implementation "com.android.support.constraint:constraint-layout:1.0.2"
        implementation "com.squareup.retrofit2:converter-gson:2.3.0"
        implementation "com.squareup.okhttp3:logging-interceptor:3.6.0"
        implementation "com.squareup.picasso:picasso:2.5.2"
        implementation "com.dlazaro66.qrcodereaderview:qrcodereaderview:2.0.3"
        compile 'com.github.elevenetc:badgeview:v1.0.0'
        annotationProcessor 'com.github.elevenetc:badgeview:v1.0.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"
        })
    }
    

    and My gradle is:

    classpath 'com.android.tools.build:gradle:3.1.0-alpha06'
    

    and its working finally.

    I think there problem in Android Studio 3.1 Canary 6

    Thank you all for your time.

    0 讨论(0)
  • 2020-12-08 06:57

    I had the same issue, I could solve it by switching fom JDK 11 to JDK 8.

    0 讨论(0)
  • 2020-12-08 06:58
    • My solution is simple, don't look at the error notification in Build - Run tasks (which should be Execution failed for task ':app:compileDebugJavaWithJavac')

    • Just fix all errors in the Java Compiler section below it.

    0 讨论(0)
提交回复
热议问题