If you want to learn how to build an Android app, you have come to the right place. In this detailed tutorial we will show you how you can start building Android apps from scratch.
Software to Install:
First of all, you will need a few tools that are given below:
- Android SDK
- Android Development Tools Plug in
- JDK 5 or JDK 6
- Apache Ant 1.7 or later
You can consultour other guide in which we have demonstrated the method of installing and running these tools. Therefore, in this guide we will skip installation details and directly begin with the development procedure to build an app. It means that right now, you have installed and configured Android SDK and also added Eclipse and ADT plug in. After that,you have to create a new Android project in Eclipse. Here you can name the project and create it as a .java file.You will also have to mention a name you will use for your app.
Saving the Launch Configuration in Eclipse:
Once you have created a project, ADT plug in will create new files that will be used later. After that, you need to create a launch configuration for eclipse that will allow you to run and debug your newly built apps. To do so, press the option saying ‘Run’ and then click on ‘Open Run Dialog’ or ‘Open Debug Dialog’. After that, select ‘New’ in the project type list and add the name of your configuration. You can also look at other tabs and set additional settings and that’s it. You have successfully saved the launch configuration for Run or Debug.
How to Build an Android App?
Now, I will show you how you can use the Ant build.xml which can be obtained from activityCreator to build an Android app. It must be mentioned here that we are assuming that you have made the app and are in testing phase. You can get the Ant build.xml from Apache’s website. Now you have to point the JAVA_HOME variable to the same location where you have installed JDK. After doing so, you can just run the Ant file and it will automatically pick up the build.xml file because both are in the same folder.
Get the Emulator Ready to Run the App:
After you have developed and builtthe app and you want to run it or test it, here is how you can do it! First of all you need to upload your file to the /data/app/ location in your emulator. You can do this with the help of ADB tool which will transfer your .apk file to the desired location. Now, start the emulator and navigate to the home screen in it. Once again run ADB and give it the command to install the newly added .apk file. After that you will be able to see the app in the application drawer where you can easily execute it. You have to keep in mind that if this does not work, you can always restart the emulator.
Log Data while the App is running in Emulator!
You can attach a Debugger to your app with the help of Eclipse and then run the DDMS tool which will forward a virtual port from your IDE to your emulator. This will help you debug the app if it crashes or does not show desired functionality.
These are some of the important steps required in the process of building an Android app.