Build your own simple ANDROID app and run it on your REAL android device

Old 8 Comments on Build your own simple ANDROID app and run it on your REAL android device 42

Let me tell you something as an android developer; it feels incredibly NICE to know that you actually programmed your smart phone to do something for you. It feels like programming a robot or may be “The Terminator” if you know what I mean.

The purpose of this post is to extend that feeling to you and motivate you to start programming for android if you love coding or got an app idea that you think can make our lives easier! Remember an idea is worthless if you don’t turn it into something worthwhile. Worst case scenario; you are not the only one in the world with that idea so someone else could turn it into something while you’re still sitting on your lazy butt!

Getting the tools and setting them up

Please read my previous post on how to do this at  http://www.geekbraindump.com/2014/06/06/introduction-to-android-programming/

Let’s build an app that says “Geek Brain Dump is great.”

  1. Start eclipse and click OK on the dialog box that appears
  2.  On the upper left corner, click x just above Welcome!
  3.  Click file then New and finally Android Application Project
  4.  Enter the following:
  • Application Name: GeekBrainDumpApp
  • Target SDK: Choose API 19
  • Leave everything else unchanged and follow the next steps below

Next Steps

  1. Click Next
  2. Click Next
  3. Click Next
  4. Click Next
  5. Click Finish

Modifying the code a bit

  1. On your left in eclipse window, locate a folder called res and double click it
  2. Locate values folder and double click it
  3. Double click on strings.xml
  4.  Under the scroll bar that appears immediately in eclipse window click strings.xml
  5. Locate “Hello world!” NOT hello_world and change that text to “Geek Brain Dump is great”
  6. Go to file then save [If Auto Monitor Logcat Dialog box appears, just click No then OK]

Exporting your app into a folder on your computer

  1. Go to file then export
  2. Double click on Android then click Export Android Application
  3. Click Browse and then GeekBrainDump and click OK
  4. Click Next
  5. Click Create new keystore
  6. For location: click Browse, Select folder and under File name: enter GBD
  7. Enter and confirm your password
  8. Enter the following:
  • Alias: GBD
  • Password: enter the password you created above and confirm it
  • Validity (Years): Enter 45 First and Last Name: Enter your names

Next Steps

  1. Click Next
  2. Please note Android executables (.exe in windows) are called APK files so browse for your apk destination
  3. Click save then Finish

Installing the app on your android device

  1. Locate the  name of your apk file (Remember your apk destination)
  2. Send it to your android device either using bluetooth or USB
  3. Browse for your apk file on your android device and click install (Externally or internally)

Done! That’s what programmers do to create programs and apps. If you gave up in the middle then may be coding is not your thing.

Got a question? Comment below.

 

Author

William Oneb

William Oneb is Java Programmer, Android Developer, Web Designer and is currently studying Objective C. He has developed at least 3 wordpress plugins/widgets. He is interested in iOS development too.

Related Articles

8 Comments

  1. danjuma kolo June 12, 2014 at 5:45 pm

    Nice post

    Wouod luv to start somthing like these

    Let me have address

  2. James Anderson Merritt June 15, 2014 at 1:00 am

    Your step-by-step instructions worked like a champ. I, of course, diverged from the specific detail of the recommended app title and display string, which is where I got into trouble. The IDE presented an input box for the string value. In the fine print, it talks about the need for special handling for apostrophes, but I, of course, didn’t read that, and so entered a word that had an apostrophe in it, which caused the subsequent compilation to fail. This was my very first experience with Eclipse, so it took me a while (including an interruption from my son, who came down tonight to visit for Fathers’ Day) to get my bearings and track down the error messages. Once I did, it was clear that I needed to escape the apostrophe. Fixing that, and going back to regenerate the .apk file took me slightly off the rails of your recipe, but I managed to make all the right choices and end up with an executable that worked on my smartphone. Dealing with the mistake wasn’t really that big a deal, but seeing my “very first android app,” running on my own phone was indeed a thrill. Thanks for publishing the instructions. (Incidentally, you might want to mention that many people’s devices will be set by default to refuse to install this “app of unknown origin.” It’s easy to defeat this prophylactic behavior, but it should probably be reinstated after the homemade app is successfully installed. The user should probably pay attention to how to find this setting again in order to put it back to default.

  3. Sanjish July 7, 2014 at 7:01 am

    When Exporting,The error pops-up
    “The Project has complitation error”

    • William Oneb July 18, 2014 at 10:49 am

      Hello Sanjish,

      A COMPILATION ERROR would occur if you made a syntax error in your code. It’s likely that you made that error while modifying the code under the heading “MODIFYING THE CODE A BIT” Please review your code and follow every single step that I’ve outlined just like James Anderson above did.

      Thanks for engagement.

  4. Peter B July 17, 2014 at 7:11 pm

    Pretty good article. I aspire to write android apps and I am currently trying to learn Java. I made a really simple app that asks the user “diameter?” then the user imputs a number and the system outputs the area of a circle with that diameter. I know it sounds silly but I am really proud of my practice app lol. To make that I imported the Java.util scanner. Are the Java utilities the same when working for android or are they different. Also id like to get a java programmer’s opinion on something. Do you recommend only importing the utilities you will need for your program or do you recommend importing all Java utilities in the beginning so they are all available should you need them. I have heard both strategies endorsed by different people. Thanks for this post though. It’s gonna be cool to try out during my next session.

    • William Oneb July 18, 2014 at 10:45 am

      Hello Peter B, thanks for engaging in my article. Java utilities are VERY DIFFERENT from those of android. For instance, you can’t use java.util.Scanner to get input from the user. You have to use a combination of XML code and a pre-written subroutine or method. I won’t go into details on how to do that for now but keep in mind that they’re so different.

      I think the best practice is to import all utilities/classes using a wildcard (*) from the MOST RELEVANT packages, and use INDIVIDUAL imports when using just one or two classes from a given package.

Leave a comment

Back to Top