John Joe
John Joe

Reputation: 12803

Warning:Gradle version 2.10 is required. Current version is 2.4

I trying to implement Android Push Notification using GCM. Below are the errors I get

Latest error

  Warning:Gradle version 2.10 is required. Current version is 2.4. If using the gradle wrapper, try editing the distributionUrl in C:\Users\seng\AndroidStudioProjects\ChatApp\gradle\wrapper\gradle-wrapper.properties to gradle-2.10-all.zip

Can't start Git: git.exe
            Probably the path to Git executable is not valid. Fix it. (show balloon)

App level build.gradle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.example.seng.chatapp"
        minSdkVersion 15
        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'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'

    //This line is added
    compile 'com.google.android.gms:play-services-gcm:8.3.0'
}

//This line is added
apply plugin: 'com.google.gms.google-services'

Project level 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:1.3.0'

        //These two lines are added
        classpath 'com.google.gms:google-services:1.5.0-beta2'
        classpath 'com.android.tools.build:gradle:2.0.0-alpha6'
        // 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

#Mon Jul 18 23:51:22 SGT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
https\://services.gradle.org/distributions/gradle-2.10-all.zip=

Upvotes: 0

Views: 339

Answers (2)

skynet
skynet

Reputation: 726

  1. Update the distributionUrl in gradle-wrapper.properties to

https\://services.gradle.org/distributions/gradle-2.10-all.zip

  1. Also you can update the gradle build tool in root build.gradle as well as in app level build.gradle file to the latest version. In my case it's classpath 'com.android.tools.build:gradle:2.1.2'

Upvotes: 0

chiuki
chiuki

Reputation: 14700

You need to edit gradle/wrapper/gradle-wrapper.properties.

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

Upvotes: 1

Related Questions