Execution Failed for task :app:compileDebugJavaWit

2019-01-02 20:43发布

I am developing an Android App in Android Studio. Not quite sure what went wrong. I was successfully building a few days ago. Any help would be great.

Here is the error:

Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

Here is my build.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "21.1.2"

defaultConfig {
    multiDexEnabled true
    applicationId "com.tubbs.citychurchob"
    minSdkVersion 14
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
      proguardFiles getDefaultProguardFile('proguard-android.txt'),        'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.parse.bolts:bolts-android:1+'
compile 'com.android.support:recyclerview-v7:23.1.0'
}

27条回答
深知你不懂我心
2楼-- · 2019-01-02 21:25

I encountered the same error. JAVA_HOME pointing to the correct version of JDK. All support libraries and build tools updated. Was still facing the same issue.

I am using Android annotations in my project. I added a new View..and there was already an existing view with the same name in the Java file. When I run the project, instead of indicating the view already exists, I was receiving the above error.

Check your java files errors if other solutions does not work.

查看更多
与君花间醉酒
3楼-- · 2019-01-02 21:26

1st step:

1st stape

2nd step:

2nd Step

I try both of ans , But nothing work . I thing here is the solution.

From your project-

go to Gradle Scripts >> build.gradle (Module:app) then remove below code (if exist)

.............................................

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_6
}

.............................................

remove it and then clean the project then Run. no java home need to to set, no need to change version

查看更多
零度萤火
4楼-- · 2019-01-02 21:28

in build file change compile files('AF-Android-SDK.jar') to compile files('libs/AF-Android-SDK.jar') it will work

查看更多
登录 后发表回答