Installing Android Studio IDE in Ubuntu – Hello World Application

Google I/O started yesterday, and Google released an early access preview version of Android Studio, a new IDE based on IntelliJ IDEA with drag-and-drop GUI layout editor, Gradle-based build system, Lint tools, the ability to preview how apps look on different screen sizes, and more. This may eventually replace the Eclipse + ADT Plugin combination currently used, so I’ve decided to give it a try in Ubuntu 13.04 64-bit, but it’s also available for Windows and Mac OS X.

First, head over to Android Studio Installation instructions, and download Android Studio for you operating system via your Browser (You’ll have to accept an EULA), then open a terminal to extract it:


Now let’s start Android Studio:

And I did press enter to continue, but Android Studio complained about JAVA_HOME no being defined. Let’s just install Sun Oracle JAVA JDK since this is the recommended method. I’ve used the  instructions provided on Mark Loiseau blog to do so.

Download the latest Sun Oracle Java JDK (now 7.21u) from http://www.oracle.com/technetwork/java/javase/downloads/index.html. For Ubuntu 64-bit, select jdk-7u21-linux-x64.tar.gz.

Let’s install, and configure the system to use the JAVA JDK


This should be it, let’s confirm we’re using the right version:


I also had to install some extra dependencies to workaround issues with adb when running the application:


Let’s start Android Studio again with ./studio.sh

Android_Studio

Success! If you already have project based on Eclipse, Google Provides instructions to migrate your Eclipse apps to Android Studio, but today, let’s just start a New Project.

Android_Studio_New_Project

You’ll just need to provide an application name (e.g. Hello_World), and change the Package Name (replace com.example by your own) to remove a warning, and click on Next. There are several options in the wizard, but I’ve just clicked on Next several times to complete the creation of the new project. The first time will take some time since Android Studio will download, install and configure Gradle build system.

Android_Studio_Gradle_Download

Now just open the “MainActivity” as shown below to see the source code.

Android_Studio_Project_Java

Edit the code as follows (Changes highlighted in green):


I’ll use the emulator for this hello world example, so we need to configure Android Studio to use it. Click on Run->Edit Configuration, select emulator, and create a Android Virtual Device by clicking on …  (e.g. Nexus 4), and click OK.

Android_Studio_Run_Configuration

Time to run the application by pressing the Run icon (green triangle) or pressing Shift+F10. Now be a little patient, and after a while, you should see “Hello, Android” displayed in the Emulator.
Android_Studio_Hello_World

Further information is available in Android Studio Tips and Tricks page.

Share this:

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

Radxa Orion O6 Armv9 mini-ITX motherboard
Subscribe
Notify of
guest
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
31 Comments
oldest
newest
Boardcon CM3588 Rockchip RK3588 System-on-Module designed for AI and IoT applications