jemz jemz - 3 months ago 56
Android Question

Error when running gradle command despite upgrading wrapper

I already set this to my gradle.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip


when I type command
gradle
it always show error

Minimum supported Gradle version is 2.14.1. Current version is 2.11. If using the gradle wrapper, try editing the distributionUrl


did I miss something?

here is my build.gradle (project)

apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion '24.0.1'

defaultConfig {

minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}


gradle.build ( module)

// 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.1.3'

// 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
}


Thank you in advance.

Answer

"when I type command gradle" indicates that you are starting the build from the command line. In this case use gradlew from the projects root directory otherwise the wrapper will not be used. The command gradle starts the gradle version permanently installed on the box.

Try gradle --version and ./gradlew --version to confirm.