android studio "Use gradle wrapper" grayed out
Solution 1:
1) Create a new simple project with Android Studio.
2) Find the gradle folder in the new project.
3) Use the export option in eclipse to create the build.gradle script. (Requires at least adt version 22.0)
4) Copy the gradle folder into the project you want to export to Android Studio.
5) Now try to import this project, u shall be able to select the wrapper check box.
This may resolve the problem you asked for, you can also set the Gradle home path and use the other option just fine.
Hope this helps!
Solution 2:
I had this issue with a project that I had already previously built using Android Studio. It turned out that selecting the project appended a /gradle
to the path of the directory when searching for a gradle wrapper. Removing the /gradle
allowed me to select the option to use the default gradle wrapper.
Solution 3:
For those intellij + Gradle users, that arrive here via Google...
I had the same "greyed out" issue, on osx, NOT on an Android project though.
To resolve, I had to...
Install gradle. (If not already installed)
(if you use Homebrew)
`> brew install gradle `
In the terminal, remove your gradle/wrapper folder.
Run the gradle wrapper task (this will download/create the wrapper)
> gradle wrapper
Attempt to re-import the project in intellij
Solution 4:
I had an existing project with this problem. I already had gradle on my system, so what I did to fix it was remove everything from my build.gradle except:
task wrapper(type: Wrapper) {
gradleVersion = '1.10'
}
If you don't have a build.gradle, create one. Then run gradle wrapper
. This will download the wrapper. Then put the original (Android-ish) contents of your build.gradle back, and go to your Project Settings in IntelliJ/ADT. You should be able to choose the Use gradle wrapper
option now
Solution 5:
Here's the simpliest sollution which works for both AndroidStudion and Intellij Idea
- Go to Preferences -> Build, Execution.. -> Build Tools -> Gradle
- Check "Use gradle wrapper task configuration"
- Click apply (gradle wrapper will be downloaded,
gradlew
,gradle.bat
files will be added to your project) - Check "Use default gradle wraper"