Could not execute build using Gradle installation/distribution

Hello all, I have been developing Android app with Intellij IDEA on Mac. Currently I need to also work on PC but I have difficulties in setting up a project in Intellij IDEA on PC (Windows 7). I can't get passed the error message saying:

Error:Android Gradle Build Target: org.gradle.tooling.GradleConnectionException: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.2.1-all.zip'.


or if I set it to my local gradle installation, it says:

Error:Android Gradle Build Target: org.gradle.tooling.GradleConnectionException: Could not execute build using Gradle installation 'C:\Program Files\gradle-2.4'.


Tried few solutions offered by people who got similar problems and solved theirs, but it won't solve mine.

Even a simple new project setup won't get passed this error. Anything that I missed?

Details of my setups:
  • OS: Windows 7 64Bit
  • Intellij IDEA 14.1.3
  • JDK 1.8.0_40
  • I also installed Gradle locally in order to try solving this issue


Tried invalidate caches/restart, deleted .gradle folder, turn on/off "Use auto-import", alternating "Use default gradle wrapper", "User customizable gradle wrapper", "Use local gradle distribution". None of them works.

settings.gradle at the root of my project folder:

':app'

build.gradle at the root of my project folder:

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

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.1'

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

allprojects {
    repositories {
        jcenter()
    }
}


build.gradle at my app folder

    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.1'
    
}
}
apply plugin: 'com.android.application'

repositories {
    jcenter()
}

android {
    compileSdkVersion 21
    
buildToolsVersion "21.1.1"

    
defaultConfig {
        applicationId "com.flake.myapplication2.app"
        
minSdkVersion 9
        
targetSdkVersion 21
        
versionCode 1
        
versionName "1.0"
    
}

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_6
        targetCompatibility JavaVersion.VERSION_1_6
    }
    buildTypes {
        release {
            minifyEnabled false
            
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        
}
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.2'
}


I also see some messages "dependencies cannot be applied to groovy.lang.Closure" if that's related.

Thank you for your help.

4 comments
Comment actions Permalink

Attach idea.log (https://intellij-support.jetbrains.com/entries/23352446) and the output from the gradle build command in the command line.

0
Comment actions Permalink

Thank you for your response. Attached is idea.log

And this is message from gradle build:

Information:Gradle: Executing tasks: [clean, :app:compileDebugSources]
Information:14/06/2015 7:34 AM - Compilation completed with 1 error and 0 warnings in 7s 214ms
Error:Android Gradle Build Target: org.gradle.tooling.GradleConnectionException: Could not execute build using Gradle installation 'C:\Program Files\gradle-2.4'.


Attachment(s):
idea.log.zip
0
Comment actions Permalink

It means that ths problem is not specific to InetlliJ IDEA, there is some issue with your Gradle installation, JDK or environment settings.

You can ask for help in Gradle specific forums or at http://stackoverflow.com/ .

0
Comment actions Permalink

Ok. Thanks. I didn't expect it is specific to Intellij IDEA but I thought someone might have experienced the same iss
ue and know how to solve it. I will post the question in Stackoverflow. Thanks.


0

Please sign in to leave a comment.