Creating a Development Environment for Android Apps on Windows – Part 1: Install Android Studio

First post in this series: Introduction to DbTradeAlert

0. Prerequisites

This post details how to set up Android Studio 2.1 on a x86 based machine with 64 bit Windows.

You need about 0.5 GB disk space for Android Studio itself and at least 3.8 GB for Android SDK and the default system image. If you have to use an ARM based system image that will need an additional 2 GB. Installation will need even more space due to temporary files.

1. Install Java

Dowload the current Java SE Development Kit (JRE not sufficient but JDK needed) which is version 8u91 at the moment with a size of about 180 MB. You probably want a 32-bit version even on 64-bit Windows.

Run the installer using the default options. This will install the JDK to “C:\Program Files (x86)\Java\jdk<version>”, for example “C:\Program Files (x86)\Java\jdk1.8.0_91”. Copy the path for reuse in the next step.

Java programs on Windows need an environment variable to find the Java runtime. For some reason the installer doesn’t set this variable. To remedy this open an administrative command prompt and type “set JAVA_HOME” to check. The output should be “Environment variable JAVA_HOME not defined”. If the output shows a directory there is probably an old version of Java installed which you should uninstall first.
To set the environment variable for all users type using the copied path:
setx JAVA_HOME "C:\Program Files (x86)\Java\jdk1.8.0_91" /M

Now Windows still needs to know where to find java.exe. Use the command prompt to add JAVA_HOME’s bin directory to the PATH variable for all users. Make shure to specify the M switch or this will mess up your PATH:
setx PATH "%PATH%;%JAVA_HOME%\bin" /M

The last step is to check if Java is installed correctly. Open a new command prompt and type “java -version”. The output should now show the Java version.

Remember to update JAVA_HOME each time you install a new version of Java and uninstall the old version.

2. Install Android Studio

Dowload Android Studio (IDE, SDK, Android 6, Emulator). Version 2.1 is about 1.2 GB in size.

Install using the defaults if you can live with the SDK being in “C:\Users\<AccountName>\AppData\Local\Android\sdk”. It probably doesn’t default to the Program Files folder because automatic updates would trigger an UAC prompt there. The SDK also doesn’t like spaces in its path so the reasonable folder “C:\Program Files\Android\SDK” is out of reach.

When the installer finally starts Android Studio you will get an “No JVM installation found. Please install a 64-bit JDK.” error message on 64 bit systems and the same will happen when you start Android Studio from the Programs menu. That’s because both point to “C:\Program Files\Android\Android Studio\bin\studio64.exe” instead of “…\studio.exe”. Update the properties of the Programs menu entry and try again. After completing the setup wizard Android Studio should start.

If you get an error message about Android Studio being unable to create a virtual device just click Finish – the next part will deal with that.

In the welcome screen opt to start a new project accepting all the defaults. After a minute or two of your CPU hard at work you should see your app.

DbTradeAlert - Setup - Android - TestApp in Android Studio

Test App in Android Studio

By the way: the path for projects defaults to “C:\Users\<AccountName>\AndroidStudioProjects” and there is no setting for it. Whatever you change it to will be used for future projects.

If you need help for Android Studio you can also look up the respective topics for the IntelliJ IDE as Android Studio is a customized version of it.

Next post: Connect a Device

Additional Ressources

Advertisements
This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s