4

I am just trying to compile the latest version of u2020-daggr2 in Android stu![e I imported it as a gradle project. But I get error complaining about gradle! I did edit the gradle-wrapper.properties. Rebuilding however did not work. I did see: Gradle 2.1 is required Migrate to Gradle wrapper and sync project which seems like same issue but on Studio I did not find:

Settings -> Gradle and click Use default gradle wrapper (recommended).

I did not find where to do this in Studio. First off there is no menu that just says Setting. There is : File->Other Setting->Default Setting. But nothing but gradle vm parameters etc. Nothing about using default gradle wrapper. enter image description here Do I need to have a local copy of gradle 2.1 for this to work? enter image description here ![enter image description here][4] enter image description here

gradle wrapper.properties is edited as such: distributionUrl=https://services.gradle.org/distributions/gradle-2.1-all.zip

Error:(20) A problem occurred evaluating root project 'u2020-dagger2'.

Failed to apply plugin [id 'com.android.application'] Gradle version 2.1 is required. Current version is 2.2.1. If using the gradlewrapper, try editing the distributionUrl in /Users/Mac1/Downloads/u2020-dagger2 /gradle/wrapper/gradle-wrapper.properties to gradle-2.1-all.zip

Community
  • 1
  • 1
Mobile Man
  • 291
  • 2
  • 5
  • 13
  • do you have the latest gradle downloaded? – Raghunandan Mar 21 '15 at 05:23
  • You go to file settings under that you will findle plugins gradle. You can use the local gradle copy instead of the one from your project. Use the latest gradel version – Raghunandan Mar 21 '15 at 05:39
  • Let me check this. Actually no. File -> Setting does not exist – Mobile Man Mar 21 '15 at 06:37
  • I've added screenshots so people don't just throw these statements around like it's under project->settings or file->settings. No its not. – Mobile Man Mar 21 '15 at 06:47
  • it is i can also post a screen shot. or you can update your gradel by goto plugins gradle. I am not sure what version of android-studio you are using – Raghunandan Mar 21 '15 at 06:48
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/73465/discussion-between-raghunandan-and-mobile-man). – Raghunandan Mar 21 '15 at 07:02
  • http://stackoverflow.com/questions/29204272/how-to-tell-when-gradle-wrapper-is-on-off-in-android-studio Any ideas? – Mobile Man Mar 23 '15 at 06:21
  • Check the following link. http://stackoverflow.com/questions/19460349/gradle-version-1-8-is-required-current-version-is-1-6?rq=1 – Murali krishna Dec 22 '15 at 08:55

2 Answers2

6

click on your build.gradle file in project explorer and make changes as

dependencies {
        classpath 'com.android.tools.build:gradle:1.1.2
}

ReBuild your project! Hope this helps.

silent_programmer
  • 768
  • 2
  • 8
  • 18
5

You have to use this gradle-plugin in your build.gradle

classpath 'com.android.tools.build:gradle:1.1.0'

Android Studio 1.1.0 requires:

  • Gradle 2.2.1 (you can set this value in the gradle-wrapper.properties)

  • Gradle plugin 1.0.0/1.1.0 (you can set this value in your build.gradle)

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
  • Are you talking about in here: dependencies { classpath 'com.android.tools.build:gradle:0.13.3' classpath 'com.jakewharton.hugo:hugo-plugin:1.1.0' classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4' } – Mobile Man Mar 21 '15 at 07:19
  • And is there a place in studio to tell studio to use the wrapper. – Mobile Man Mar 21 '15 at 07:20
  • You have to change the 0.13.3 in 1.1.0. You can edit the files. Take a look here http://stackoverflow.com/a/27993506/2016562 – Gabriele Mariotti Mar 21 '15 at 07:21
  • This works. Still wondering if there is on/off switch for wrapper somewhere. – Mobile Man Mar 21 '15 at 07:30
  • Hey Gabriele, I'm still wondering about the wrapper? Studio/Gradle don't seem to know if its on/off and neither do I. What determines if wrapper is used or not? Do you know when the wrapper is on or off? – Mobile Man Mar 23 '15 at 06:13
  • Where can I find the most updated version of gradle to put there? It seems that as opposed to repos, Android-Studio doesn't tell me about new versions for this. Currently what I've found is 1.3.1, while Android-Studio puts 1.3.0 as the default one. – android developer Nov 10 '15 at 11:29
  • @androiddeveloper Use the plugin 1.3.1 and gradle 2.5. For a full list: http://stackoverflow.com/questions/32659079/cant-update-to-android-studio-gradle-1-4-plugin/32659415#32659415 For a full compatibility list: http://stackoverflow.com/questions/22252956/android-studio-gradle-issue-upgrading-to-version-0-5-0-gradle-migrating-from-0/22256954#22256954 – Gabriele Mariotti Nov 10 '15 at 12:19
  • 1
    @GabrieleMariotti So you mean I need to check this website for the newest version: https://developer.android.com/intl/ru/tools/revisions/gradle-plugin.html ? – android developer Nov 10 '15 at 12:40
  • Not only, there are some beta versions: http://tools.android.com/tech-docs/new-build-system – Gabriele Mariotti Nov 10 '15 at 12:42
  • @GabrieleMariotti I don't understand how to find on the link you've provided, which version of gradle to put... – android developer Nov 11 '15 at 11:17