3

I just spend some time and failed trying to migrate an existing android studio project from gradle 1.8 to gradle 1.9 final ( which was released yesterday 19th Nov ).

I read most of the other gradle related posts here but none worked for me. here a list of what I've tried so far:

  • ./gradle/wrapper/gradle-wrapper.properties changed distributionUrl to gradle-1.9-all.zip
  • Rebuild Project
  • in android-studio: Tools -> Android -> Synch Project with Gradle Files
  • running command gradle wrapper in project dir to update the wrapper
  • -

build.gradle file

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.6.+'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.0"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 16
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
}

dependencies {
    compile 'com.android.support:appcompat-v7:18.0.0'
}

all ended with the "need gradle 1.8, change your gradle-wrapper.properties to gradle-1.8-all.zip" error message.

Michael D.
  • 1,795
  • 2
  • 18
  • 25
  • but my Android Studio automatically updates Gradle to 1.9. How can i turn back again to 1.8 ? thanks :) – hqt Nov 26 '13 at 04:24

2 Answers2

13

Gradle 1.9 isn't supported with the Android plugin 0.6.3; it requires 1.8. The plugin uses internal Gradle APIs and is tied to specific Gradle versions to ensure it works. This limitation will be lifted in the future, but will require some new features in Gradle.

The next version of the plugin will support Gradle 1.9.

EDIT:

Android Studio 0.4.0 and Android Gradle plugin 0.7.0 have been released; these support Gradle 1.9. At the time of writing, Gradle 1.10 is current, but is not supported yet in v0.7.0 of the plugin.

Scott Barta
  • 79,344
  • 24
  • 180
  • 163
  • but my Android Studio automatically updates Gradle to 1.9. How can i turn back again to 1.8 ? thanks :) – hqt Nov 26 '13 at 02:35
  • 1
    just set in your project/gradle/wrapper/gradle-wrapper.properties distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-all.zip – Michael D. Nov 26 '13 at 05:18
2

You could try this:

Close your Project and try to open your project, but instead of choosing the root folder of your project choose your settings.gradle file.

AS will ask you if you want to open this project -> click "Yes". Than a window appears "Import Project from Gradle". Make sure that "Use default gradle wrapper" is selected.

This helped me after upgrading AS to 0.3.1, since this version you need gradle 1.8.

owe
  • 4,890
  • 7
  • 36
  • 47
  • didn't work. as Scott Barta pointed out, it's not possible, yet. – Michael D. Nov 20 '13 at 17:53
  • Voted up because this answer solved this problem for me http://stackoverflow.com/questions/18256177/android-studio-local-path-doesnt-exist – kntx Dec 11 '13 at 12:56