Want to know how to write Google Android apps? Most Android applications are written in Java – a relatively easy to learn, friendly language for new developers. Aside from the possibility some money, you could actually contribute to the Android community. If you’ve got innovative ideas and the drive to see them spread, the Android market is for you! Let’s get you started on your very first Android application design.
Before we get to how to write Google Android apps – first, a bit of overview. Android apps (much like almost any mobile app) are developed on a computer – PC or Mac (generally) – and then compiled and sent to the device for testing. If you don’t have an Android device yet, there are emulators that simulate an Android device on your computer, meaning that you can still develop an Android game or application without owning one.
Step One: Download & Installation
First download and install the latest version of the Java JDK. Do not use the 64-bit version as it may cause you issues later on. Instead install the x86 version, with the default options.
Second, get the Android SDK – make sure to install the 32-bit ADT-Bundle version for Windows, even if you have a 64-bit system. That’s because everyone ends up complaining about the 64-bit version’s compatibility issues.
The Android application design bundle includes all the necessary components, including Eclipse. However, it’s not an installable file. You will unzip it to any directory desired. Keep in mind where you unzipped this file.
If you have any problems with Java, uninstall all versions and retry installation. If that fails, try the 64-bit version of the JDK and the ADT-Bundle, if you have a 64-bit system.
Step Two: Configure The ADT-Bundle
First, start Eclipse, which is located within your ADT-Bundle within the Eclipse folder. If you are prompted to locate the Android SDK, you’ll have to manually find it from within your downloaded ADT-Bundle. It’s in the SDK folder.
Second, you’ll be prompted to set your workspace location — the default is good enough. If you have problems starting or configuring Eclipse, close Eclipse and delete your workspace, which is located wherever you placed it.
Third, click on the Android SDK icon in your toolbar in the ADT-Bundle.
You’ll be prompted to download additional material for the SDK. Download the following:
- “Samples for the SDK”;
- “Documentation for Android SDK”;
- “Google APIs” for the 4.2 (API 17) package.
You might notice that you can also install material for older versions of Android. If you want, go nuts, but it will increase your download time and take up hard drive space. Next, click on “Install packages” in the lower-right hand side of the screen.
Fourth, check for updates to Eclipse by selecting “Help” from menu bar and choosing “Check for updates”.
Step Three: Set Up The Android Virtual Device (AVD)
First, click on the AVD (Android virtual device manager) in the toolbar of the ADT interface. This creates a virtual device that lets you test your apps.
Second, you will configure the device in the following way:
- Set “Device” as whatever smartphone you use. However, this is largely irrelevant and only refers to screen size. Because you will be emulating an Android device on your computer, if you have a smaller computer screen, you may want to choose a smaller vertical resolution handset.
- Set “Target” as Android 4.2 API Level 17.
- Check the box “Use Host GPU”, which will use your system’s GPU to speed things up a bit.
You may need to play around with the settings above, such as reducing the amount of RAM available to your emulator.
Third, you will choose the AVD from the list of existing devices and then hit the “Start” button in the right column. On the following pop-up menu, launch the device.
Don’t close the AVD once it launches, you will need it for the rest of this tutorial.
Step 4: Create a New Project
Navigate to ‘File -> New -> Android Project’.
After choosing to create a new Android application design project, you will be guided through several windows. Don’t worry about the content of these, you can simply choose the default value for all of them.
However, for those of you interested in customizing the appearance of your app, there’s options to choose the Holo theme and Android launcher icon, as well as other options. However, these are cosmetic options. As long as you choose the correct SDK for the SDK that you downloaded, you’ll be OK.
It will take several minutes to create the new project. You may want to grab a cup of coffee while you wait. After you get your coffee, here’s what you should see in the AVD window:
Step 5: Configure The New Project
By default the new project contains the “Hello World” text. If you’ve ever programmed in Java (or most languages), one of the first projects that you work on is the ubiquitous “Hello World” application, which uses the Println(“Hello World”); to generate the text. However, the ADT-Bundle already includes this code — you will simply create a new file that will run within the AVD.
You will notice that the Eclipse window’s screen displays “Hello World”. You can choose to modify this text by manually clicking and dragging the words around the screen. Alternatively, once you’ve selected the text, you can modify the size, font and bold (and many other) characteristics.
To make the text bold, click on “Hello World”. In the right-side “Properties” panel, scroll down until you see “Text Style”. When you’re all finished making changes, save the file by clicking on the save icon in the toolbar up top.
At this point, you are pretty much done building the app. Save it and go to the next step.
Step 6: Run Your Program
From the Package Explorer in the left-side of the screen, open up the src folder, then open the com.example.helloworld folder. Inside you will see the file “mainactivity.java”.
Next, select “mainactivity.java”.
Above your code, you’ll see a little green “Play” button (or navigate to ‘Run>Run‘). Click it. When a popup box asks you how to run the application, you’re going to tell it to run as an “Android Application”. It will prompt you to save changes; hit yes.
Now you get to wait an eternity while your virtual device boots up. I’d recommend that you leave it open for the duration of your programming sprees, otherwise you’re going to spend more time watching the Android logo spin than you will watching your program freeze up. Just saying. Efficiency.
After everything’s done loading, your application should upload and start automatically. Which means that right after you “unlock” the device, you’ll be greeted with your first Android program.
That’s it, congratulations! The task can be a bit daunting at first, and definitely confusing, but if you stick with it you won’t be disappointed. If you step back and think about it, we only did a few really major things, the rest was just the process of connecting the pieces to make everything work.
Are you interested in Android application design? Do you want to become an Android developer? Have you ever written an Android app, and if so, what did it do? As always I love getting feedback in the comments section. As someone who answered yes to the first question, I’m in the process of learning to adequately code for my Android device, so do you have any websites or pointers that would help me or a fellow Android newbie out?
Updates to the Android Development Platform
Recently, Google released a preview edition of Android Studio, the first of its kind. When the final copy releases, developers will have access to a purpose built development kit for the Android operating system, instead of modified development environments.
The technology will likely eventually supplant Eclipse, and other SDKs. However, it hasn’t receive a release yet, so until then, we are stuck with Eclipse.
Additional Android Programming Reading and Tutorials
MakeUseOf published a guide on using MIT’s Android App Creator, which allows individuals without a background in programming to get started building Android apps. The App Creator has its own quirks and learning curve. It’s good to start with, although you will more than likely want to eventually study Java and other languages. Ryan did a quick guide to the Google version of the App Inventor, if you don’t feel like reading an e-book.
If you’re more interested in Android game, development, check out this article. And for those of you looking to read a discussion on the subject of easily programming for Android, check out our Answer section.
For those of you seeking additional coding lessons, Jessica wrote about three of the most important sources on the net for Java tutorials. I highly recommend visiting the TheNewBoston’s YouTube channel.
Explore more about: Programming.