First a bit about myself and the weird intro I wanted to use. If you get the reference, cool, if not your too young! I am just a lazy ex Air Force enlisted man turned professional software developer. I worked on air craft for some years and decided I preferred something else. That’s when I discovered Dev-C++. I learned hello world and was hooked so I ripped my reenlistment slip up in my flight chief’s face and headed to school. I graduated with a degree in computer engineering 4 years later. That was 2010. Today I write code and fix bugs on cool things and I love it.
2 weeks ago a man where I work, who has access to large sums of money, came to me and said “You like to code right? How about you come up with some ideas for mobile device apps and we will get you funded and on your way.” So my jaw dropped and did what any sane person would when told something like this. “yeah sure why not” I mean who is going to turn down a chance to get crazy funding for something you like to do even if it’s in a language you would prefer to have never existed?
I saw this question a few times here. How do you get started and set up to write apps for the android? The easy answer is having someone do it for you. Not exactly the solution I prefer even if I am lazy. So this is my addition to the community because I have seen it asked but no answer. How to get the Android SDK up, running, and writing “Hello World” should be fun right?
Oh and warning from here out. I can’t spell I am a coder not an English professor! And with that warning let’s get started.
If your one of those “retro” pc nerds, go ahead and take your 386 and text based browser back to the Stone Age, this is not for you. Your computer must be fairly modern. Windows XP or better and yadda yadda. Next you need to download some, drum roll please, free software YAY us! Everything is free and that fosters some wide spread use of this for Android.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Download Download and More Downloading
Here is the list of things to download and as close a link as I could get:
Java JDK at the time of me writing this it is Java SE 7u4. May or may not need to be installed.
Android SDK pick the correct one for your OS. Windows, Apple or Linux
Eclipse IDE Google specifically recommends Eclipse Classic. The latest version at this time is 3.7.2.
Android ADK is an add-on to Eclipse so it will be downloaded later through Eclipse
i promise i have pictures later.
Step 2: Eclipse
Now that you have everything downloaded unzip Eclipse. This software has no installer and will run standalone from anywhere. However, the Android SDK will install to your machine. I just unzip and toss it into the hard drive somewhere I can find it. In my case, on a windows machine, it’s C:/Eclipse. The first time you run Eclipse it will ask you where you want your workspace. I suggest using default selections and getting on your marry way.
Step 3: Android SDK
Next install the Android SDK. We aren’t doing anything with it yet so just run the installer and let it go. But remember where it was installed. You will have to point to it in eclipse later.
Step 4: Android ADT
Now you have eclipse and the Android SDK installed. Open Eclipse and your screen should be filled with IDE goodliness and light from the heavens will shine and all will be good in the world. Also it should look somewhat similar to the first screen shot.
Now, it’s time to install that pesky ADT thing! They put the options for this is some weird places but its oracle so who am I to question right? In Eclipse go to your Help drop down and click Install new software. Help? I know right who puts an install option in the Help section? This will open a new window with lots of new buttons to press. For now try to refrain from the natural calling to just go pushing shiny new buttons and hit Add. This will open yet another window. Give it a name, I used Android, and then copy and paste this in the location then hit OK:
I already have it installed so it is showing a duplicate error. After you have hit OK, the third window will go away and you will have a check box available in the install window. Check Developer tools and hit next at the bottom. You will see a list of tools that will be downloaded so hit next again. Accept their agreements or your deity of choice will strike you down. Along with that you won’t be able to install the ADT. Then click Finish.
Step 5: ADT Install
We are almost done with set up. All that is left is configuring the ADT, creating the Android Virtual Device (AVD), and we are off to coding our first program for the Android. So let’s get to it shall we?
Utilize the Window drop down at the top of Eclipse and click on Preferences. Mac people… you get to utilize the Eclipse drop down and click Preferences. This brings up the preferences window. Weird huh? Preferences bring up that kind of window who would have known? Click on the word Android on the left to show the Android Preferences. At this time you may or may not be asked if you want to send Google all your relevant personal data to which I say no but maybe you want Google to know you have 3 dogs, a cat and half a child. Once the personal data window goes away if you got it you should see a place to navigate to the SDK. Mine was filled in for me. If it is not for you click browse and move over to where your SDK was installed. See I told you it would be asked for later. Once it is happy with where the SDK is located, hit apply and OK or just OK whatever makes you a happy little developer.
Step 6: AVD Setup
Now on to the AVD. This is like a phone emulator of your phone for your computer. You can’t call anyone with it but you can run your new program to see how it will act.
Use the window drop down and click on AVD manager. This opens yet another window. Yes you likely guessed it click new for….another window. This window you name your new AVD. Anything you want I use test_AVD or Android_AVD. Now not many phones run Android 4 so select the Android you want to write for after naming and leave everything else default. This is just for Hello World after all. But be my guest to set it up for your phone. I won’t go into detail how to install on your phone as it’s not the scope of this little instructable. Click create AVD at the bottom and it should create it and show it with a little green check mark next to it. Close the AVD window and we are off and running like a boss.
Setup is completed. On to what you really came here for. Dun Dun Dun. Coding!
Step 7: Getting Close
If you’re new to Eclipse we will go through start to finish. If you’re a pro at Eclipse skip on over this how to start a project step.
First use the File drop down and go to new and move over to Project. This will open a new window. So many windows so little time! Click the little arrow to the left of Android and click on Android Project. Click on Next. If you are new to this I should warn you Java is a convoluted and annoying language requiring tons of “you must do this right or else” types of things. Names and other places it asks you for will undoubtedly require specific ways to do things. Expect it, do it and hate it like I do. Oh I know someone out there is going to say “but it’s there for a reason! Standards keep the world right and laws keep the world spinning around the sun!” True as it maybe the normal at home maker doesn’t care. I am a professional and I don’t care. And because of that I copied and pasted from the google site tutorial on hello world what to fill in:
Fill in the project details with the following values:
• Project name: HelloAndroid
• click next
• Build Target: Select a platform version that is equal to or lower than the target you chose for your AVD.
• Click next
• Application name: Hello, Android
• Package name: com.example.helloandroid (or your own private namespace)
• Create Activity: HelloAndroid
Once this is done you should see your project in the left pane of the Eclipse IDE. Click the little arrows next to HelloAndroid, src, com.example.helloandroid and double click HelloAndroid.java. this is the Google prefabricated hello world program. On their website they tell you how to edit it a little and I suggest you go there to read up on it.
Everything I have written thus far is there somewhere; I mean I had to learn it from somewhere too right? You don’t have to edit the code to get to run it. They suggest it to make it run better and look better.
Step 8: No Spouse Abuse Allowed!
Once you have decided to run it as is or edit it, it’s time to run it on your AVD.
Another warning here. This could take forever to load the AVD if it’s the first time you have done it. Don’t punch the computer or your wife or your little sister. It just will not help.
Use the Run drop down and click Run. It will ask if you want to save it, say yes. After hitting run a screen will open looking kind of like an android phone. This is where I always have to wait the first time. It takes forever for my AVD to run the first time.
Now just find your App on the phone and run it. Hello world on the screen and yay us we made a program for the phone.
Step 9: Outro
A few last words on this.
If you want to produce apps you have to sign them. To play at home on the emulator it uses a debug signature. Read the Google site to learn how to go about signing your apps so they can be put on the new Google Play market.
I never ran into any problems getting this up and going other than the long wait for the emulator to run. If you have troubles let me know I will see if I can help or you can go to the Android SDK site and look around.