[TUT] Setting up Android Studio & Gradle [windows 7]

This is a simple walk through of setting up the new Android Studio IDE and Gradle. Gradle is the new build system for all Android projects.

Prerequisites:

  • you have a JDK installed.
  • JAVA_HOME is set.

(you can test this by typing java -version in a console)

warning: This post is very image heavy, so get scrolling

Download Gradle (currently 1.12) (this blog shows 1.6)
Download Android Studio (currently 0.8.1)

When you have downloaded Gradle – unzip gradle. I put mine in this folder: D:\Programs\Gradle\gradle-1.6

Add gradle/bin to path. You want to add Gradle to your path so that you can use it from the command line.

Here is how you create the variables and add them to your path:

1_java_home

check JAVA_HOME is on your PATH

2_path

adding GRADLE_HOME

3_gradle_home

4_path_gradle

Now test the gradle installation is on your path, use the command gradle -v

5_gradle_test

Next run the Android Studio Installer

6_android_studio

Start Android Studio and check for updates
(not all weekly updates are made available on the site, only through the updater)

7_check_updates

Finally check that Android Studio is pointing to your gradle installations repo folder:

8_check_gradle_directory

That’s it, now go create gradle projects!

6 thoughts on “[TUT] Setting up Android Studio & Gradle [windows 7]

  1. when i try to create a new project it can’t do it and throw me this error:

    Failed to import new Gradle project: Could not fetch model of type ‘IdeaProject’ using Gradle installation ‘D:\Personal\android\gradle-1.6’.
    A problem occurred configuring project ‘:test_12’.
    A problem occurred configuring project ‘:test_12’.
    Could not resolve all dependencies for configuration ‘:test_12:classpath’.
    Could not resolve com.android.tools.build:gradle:0.4.
    Required by:
    test_12:test_12:unspecified
    Could not GET ‘https://repo1.maven.org/maven2/com/android/tools/build/gradle/0.4/gradle-0.4.pom’. Received status code 403 from server: Forbidden ( Forefront TMG denied the specified Uniform Resource Locator (URL). )

    Consult IDE log for more details (Help | Show Log)

    PD: i fallowed all steps you described in this post.

    Could you help me please ?

    1. You should swop

      `com.android.tools.build:gradle:0.4`

      for

      ‘com.android.tools.build:gradle:0.12.+’

      in your build.gradle

Comments are closed.