Gradle version 1.10 is required. Current version is 2.2.1. in android

16,181

Solution 1

You have to update the:

  • gradle plugin for Android
  • gradle version
  • proguard syntax

Gradle plugin for Android

You have to change this line in build.gradle:

classpath 'com.android.tools.build:gradle:0.9.+'

in

classpath 'com.android.tools.build:gradle:1.1.+'

Gradle Version

Change this line in gradle-wrapper.properties

distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip

in

distributionUrl=http\://services.gradle.org/distributions/gradle-2.2.1-all.zip

About proguard you have to change this line in your build.gradle

buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }

In

buildTypes {
        release {
             minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }

Solution 2

addition to @Gabriele answer

you should change

runProguard false  

to

minifyEnabled false 
Share:
16,181
Shiva Krishna Bavandla
Author by

Shiva Krishna Bavandla

I love to work on python and django using jquery and ajax.

Updated on June 09, 2022

Comments

  • Shiva Krishna Bavandla
    Shiva Krishna Bavandla almost 2 years

    I had an Android project built with Android Studio and trying to import and run it on my Android Studio but facing the below error when trying to Sync the project

    Failed to sync Gradle project 'project-android'
    
    Error:Gradle version 1.10 is required. Current version is 2.2.1. If using the gradle wrapper, try editing the distributionUrl in /Users/username/apps/android/project-android/gradle/wrapper/gradle-wrapper.properties to gradle-1.10-all.zip.
    
    Please fix the project's Gradle settings in Gradle settings
    

    gradle-wrapper.properties

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

    build.gradle

    buildscript {
        repositories {
            mavenCentral()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:0.9.+'
        }
    }
    
    allprojects {
        repositories {
            mavenCentral()
        }
    }
    
    
    Android Studio Version : 1.0.1
    

    So how to fix the above error

    Edit

    After changing the lines as indicated by @Grabiele i was getting the below errors

    Error:(22, 0) Gradle DSL method not found: 'runProguard()'
    Possible causes: 
    The project 'project-android' may be using a version of Gradle that does not contain the method.
    The build file may be missing a Gradle plugin.
    

    This is the line that i had in app/build.gradle file

     buildTypes {
            release {
                runProguard false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            }
        }
    
  • Gabriele Mariotti
    Gabriele Mariotti about 9 years
    @shivakrishna updated the answer with the proguard part
  • Shiva Krishna Bavandla
    Shiva Krishna Bavandla about 9 years
    Ok i updated the question, because i also had proguardFiles setting as above, so what to do in these situations
  • Gabriele Mariotti
    Gabriele Mariotti about 9 years
    Updated. Just said before you have to change 'runProguard false' to 'minifyEnabled false'
  • phyatt
    phyatt over 7 years
    Thank you so much for posting this!