Pre-Lab 1.1: Setting up the development environment

Overview

The goal of this pre-lab 1.1 is to get a basic grasp on the android system and set up the development environment. Make sure that you update your android handset before we start the lab session.

Android OS

Android main development language is Java, though it doesn’t use the standard Java library. You need to use the android SDK. Apps are also translated to apk (not jar) format that runs on Dalivk virtual machine on android that is a bit different than the Java Virtual Machine JVM on our computers. Java is not the only language you can program with. You can develop in native languages such as C and C++ as well for almost all application parts. However, usually C language is used for certain computational intensive algorithms such as FFT for sound or physics engines in some games. For native languages you need to set up android native development kit (NDK).
Before you start the setup, watch these videos about android OS architecture to have a broad view.

Part 1/3

Part 2/3

Part 3/3

Now, visit developer.android.com site and get yourself familiar with its different sections as it is the ultimate reference for android programming. The site provides reference on how to design a good user interface, best programming practices, API reference, how to publish you app in android Play store and how to monetize your app.

Important Article

Read this article about android apps. It provides an overall picture of different components for any application.

Installing Android Studio

Android Studio provides everything you need to start developing apps for Android, including the Android Studio IDE and the Android SDK tools. We provide instructions both for Linux and Windows, however it is strongly recommended to use Linux.

Linux

Before you can setup the development environment, you need to install the prerequisites. First you need to install the Java Development Kit by executing the following command in a Linux terminal (type in your password when prompted).

It is important to know that some binaries in android development tools (ADT) are 32 bits. Therefore, if you have a 64 bit machine, make sure you have all essential 32-bits libraries by executing the following command in terminal.

Next, you need to download Android Studio. Open this link, and download Android Studio for Linux platform. Follow these simple steps after download is complete:

  1.  Unpack the downloaded .zip file and save it to an appropriate location, such as a “Android” directory in your home directory.
  2. To launch Android Studio, navigate to the android-studio/bin/ directory in a terminal and execute studio.sh. An installation dialog box will open that will install any missing components e.g. Android sdk etc. Finish the installation with the default options. It might take a while to finish depending on your internet speed.
  3. After finishing the installation, the Android Studio welcome screen will open. It has two sections “Rececnt Projects” and “Quick Start”. Click on “Configure” under “Quick Start” and select “Create Desktop Entry”. Type your Ubuntu password if asked for authentication. Now you can start Android Studio from the unity launcher or system menu

That’s it! You’re ready to start developing apps with Android Studio. To start developing, read Lab 1.1: GUI design.

Windows

First you need to install the Java Development Kit. Download and install Java SE Development Kit 8u72 (choose the file titled ‘Windows x86’ if you’re using 32-bit Windows or ‘Windows x64’ if using 64-bit Windows).

Next, you need to download Android Studio. Open this link, scroll to the section titled “
All Android Studio Packages
“, and download the package for Windows platform (choose the recommended package). Follow these simple steps after download is complete:

  1. Launch the .exe file you just downloaded.
  2. Follow the setup wizard to install Android Studio and any necessary SDK tools.

On some Windows systems, the launcher script does not find where Java is installed. If you encounter this problem, you need to set an environment variable indicating the correct location.

Select Start menu > Computer > System Properties > Advanced System Properties. Then open Advanced tab > Environment Variables and add a new system variable JAVA_HOME that points to your JDK folder, for example C:\Program Files\Java\jdk1.7.0_21.

The individual tools and other SDK packages are saved outside the Android Studio application directory. If you need to access the tools directly, use a terminal to navigate to the location where they are installed. For example:

\Users\\sdk\

That’s it! You’re ready to start developing apps with Android Studio. To start developing, read Lab 1.1: GUI design.

Why Use Linux?

For this course you must install Linux OS. Linux is for developers while Windows is more suitable for end users and in this course you are all developers. Most of the tools used in this course all natively available on Linux. Cygwin is a workaround for Windows but seems quite a bit slower than running Linux natively. You can install Linux using one of the following three methods, although the third one is not recommended due to performance issues.

1)- Running Linux natively: This is the best option but requires a little bit more effort (bootable dvd/usb, partitioning disk etc).
2)- Install Ubuntu Linux  Using Wubi: Wubi will install Linux (Ubuntu) as a software in Windows which can be uninstalled from control panel. With this method, just like the native Linux installation, you will get an option at boot time to either start Ubuntu or Windows.

3)- Install Ubuntu Linux as a virtual machine: You can use tools like vmware player to do this, but it’ll be much slower.

Please install Ubuntu Linux using one of these methods before the lab.