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

In Android Studio 3.1, you can see the errors details in the Build window.

Open up Build tab. They are somewhat hidden, you have to expand the Java compiler node. You will see the errors there.

enter image description here

But there is a better way to see the errors. You can click on the Toggle View button to get a better view of the error. That way you don't have to expand each node.

enter image description here

查看更多
柔情千种
3楼-- · 2019-01-02 21:21

The problem is just in naming folder, if your folder to save your project contains special characters then remove them. If the error persists try to save the folder with no space.

查看更多
怪性笑人.
4楼-- · 2019-01-02 21:22

Your gradle files might be corrupted. Try running

./gradlew --refresh-dependencies

in the terminal inside android studio.

查看更多
明月照影归
5楼-- · 2019-01-02 21:22

I faced a similar problem, but I had to set manually the jdk folder on program files, so I recommend to everybody specially the ones that are upgrading to java 8, to point directly in the project settings of the android studio, either using the embed option or choosing the folder

查看更多
听够珍惜
6楼-- · 2019-01-02 21:23

Use these settings and it will work fine.

android {
     compileSdkVersion 26
     buildToolsVersion '26.0.2'

  defaultConfig {
    applicationId "com.pm.motivator"
    minSdkVersion 15
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
 }
}
查看更多
素衣白纱
7楼-- · 2019-01-02 21:24

this works for me

compileSdkVersion 25
buildToolsVersion '25.0.0'
查看更多
登录 后发表回答