0

Im having a problems when trying to implement gcm. When I try to sync gradle files this error appears:

Warning:Gradle version 2.8 is required. Current version is 2.4. If using the gradle wrapper, try editing the distributionUrl in D:\MyProjects\Android\Enjoy\gradle\wrapper\gradle-wrapper.properties to gradle-2.8-all.zip

Tried to go to wrapper and change it to 2.8, but its still not working.

Here is my app build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "enjoy.enjoyprague_restaurants_bars"
        minSdkVersion 17
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
//    android libraries activity, design
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.android.support:cardview-v7:23.1.1'
    compile 'com.android.support:recyclerview-v7:23.1.1'

//    application
    compile 'com.android.support:multidex:1.0.1'

//    volley for handlers
    compile 'com.mcxiaoke.volley:library:1.0.19'
    compile 'com.google.code.gson:gson:2.4'

//    picasso
    compile 'com.squareup.picasso:picasso:2.5.2'

//    simple xml
    compile('org.simpleframework:simple-xml:2.7.1') {
        exclude group: 'stax', module: 'stax-api'
        exclude group: 'xpp3', module: 'xpp3'
    }

//    floating action menu
    compile 'com.oguzdev:CircularFloatingActionMenu:1.0.2'

//    Google Map api
    compile 'com.google.android.gms:play-services:8.4.0'
    compile 'com.google.android.gms:play-services-gcm:8.4.0'
    compile 'com.google.maps.android:android-maps-utils:0.4'
}
//google gcm sender
apply plugin: 'com.google.gms.google-services'

and top 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:2.0.0-alpha3'
        classpath 'com.google.gms:google-services:2.0.0-alpha3'

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

allprojects {
    repositories {
        maven { url "http://dl.bintray.com/populov/maven" }
        mavenCentral()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Miljan Vulovic
  • 1,586
  • 3
  • 20
  • 48

4 Answers4

1

Open gradle folder in your project directory, and change gradle wrapper properties file. (you can find that last line indicating the path to gradle used in build). You may find it incorrect (e.g. http\://) fix it to (http://)

0

Use Graddle Wrapper

1)

Check distributionUrl and see if it is specified as gradle-2.8.zip at the Gradle-wrapper properties file within the Android project.

Project/gradle/wrapper/gradle-wrapper.properties

Run Gradle Wrapper at the top level of the project

Unix: ./gradlew wrapper

Windows: gradlew.bat wrapper

Build with Gradle Wrapper.

Unix: ./gradlew build

Windows: gradlew.bat build

Victor Viola
  • 575
  • 1
  • 4
  • 14
0

Find in your project's structure in Android Studio this file

enter image description here

Open gradle-wrapper.properties and change this line:

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

with

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

It should work

piotrek1543
  • 19,130
  • 7
  • 81
  • 94
0

Ok, so, Android Studio is very buggy. Now, what you need to do is go to this question and do exactly as they said there. Take it to offline and that stuff. It will work, guaranteed.

https://stackoverflow.com/a/21996772/4458300

Community
  • 1
  • 1
Vulovic Vukasin
  • 1,540
  • 2
  • 21
  • 30