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:02

Try to upgrade your buildToolsVersion to "23.0.1", like this:

compileSdkVersion 23
buildToolsVersion "23.0.1"

If you didn't install the buildTools for this version, please download it with SDKManager as hint.

查看更多
大哥的爱人
3楼-- · 2019-01-02 21:02

I faced this issue after upgrading the Android studio to version 2.2.2, I solved it by using embedded JDK as recommended : enter image description here

查看更多
忆尘夕之涩
4楼-- · 2019-01-02 21:02

In my case, the issue was not resolved by updating butterknife

from: "com.jakewharton:butterknife:8.4.0" to: "com.jakewharton:butterknife:8.8.1"

I've tried to @BindView inside Adapter class and no success. As soon I used .findViewById(R.id.message_time), compilation had been completed successfully.

查看更多
余生无你
5楼-- · 2019-01-02 21:04

I had the same issue and already tried all of solutions but to no avail.

It turned out that using Java 9 was the problem. Installing a lower version Java (jdk 1.8.0_162) worked for me.

查看更多
闭嘴吧你
6楼-- · 2019-01-02 21:04

Please check your app's build.gradle. I had the same problem, finally I found the problem was in my build.gradle file dependencies{}, it add extra .jar file which actually didn't exist in my project as dependency. So I delete this dependency, and the problem has gone.

查看更多
浪荡孟婆
7楼-- · 2019-01-02 21:05

Just complementing @yuchaozh answer above that helped me solve it. (I don't have rep to comment)

Run this to know which java version you have

ls /Library/Java/JavaVirtualMachines/

You'll get an output like:

jdk1.8.0_111.jdk

Replace with your Java version and run this command to export the correct path.

export JAVA_HOME="/Library/Java/JavaVirtualMachines/<YOUR_JAVA_VERSION>/Contents/Home"
查看更多
登录 后发表回答