'Gradle sync failed: CreateProcess error=216

I am running windows 7 32bit. I have upgraded from Android Studio from 1.5 to 2.2 and started following problem. I tried creating project but it didn't fix the error. What should I do?

Gradle sync failed: CreateProcess error=216, This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher Consult IDE log for more details (Help | Show Log)

build.gradle

    // 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:2.2.0'

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

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip


Solution 1:[1]

in my case it was down to two reasons, the SDK location and the JDK location. With my fresh installation of Android Studio 2.2.3 I wanted to my existing Android SDK and hence it was excluded from th install. After the installaion the JDK folder (>1.8). is set to the JRE. I was not able to change this to the JDK as the

FILE->Project Structure->SDK Location settings

report an incorrect SDK folder. The SDK folder had a space in the file name (German Windows) and was reported to be incompatible with the NDK. Icould only resolve this issue by creating a drive letter pointing to the folder one level obove the Android SDK (which I am not going to move).

subst a: "C:\Program Files\Android"

Provide the drive letter plus path containing the SDK to the Android SDK settings. Also change SRE to an SDK installation folder (SDK>1.8). Only if the settings folder is completely error and warning free the changes are accepted.

A Tools->Android->Sync with Gradle Files

succeeded.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Markus Foerstel