Pages

Tuesday, 10 May 2011

First Steps: Android project structure in Eclipse

Android Project structure in Eclipse
This article is a quick guide to the breakdown of the project structure of a typical, simple Android project within Eclipse. The numbered items below refer to the image to the right.
  1. Project root folder (see 7 for details of individual files)
  2. src folder. This is where your java code files are stored.
  3. package folder. This is organised by package name with the java class files within.
  4. Main.java is a java class file, in this case the main activity. Note the exclamation denoting a compilation warning.
  5. Web.java is another java class (without warnings or errors).
  6. gen folder. The generated compiled files when a project is built. You do not need to venture into this folder.
  7. Google APIs folder. The API library folder.
  8. assets folder. This is where you place additional assets for use in your project, such as font (ttf) files.
  9. res folder. This is where the resource files are stored, such as your drawables (images), layouts and string values.
  10. drawable-hdpi folder. High density drawables (images) for use in your project.
  11. drawable-ldpi folder. Low density drawables (images) for use in your project.
  12. drawable-mdpi folder. Medium density drawables (images) for use in your project.
  13. layout folder. This contains the XML layout files that define the screens in your project.
  14. main.xml. This is the layout for the Main activity, defined in Main.java.
  15. web.xml. This is the layout for the Web activity, defined in Web.java.
  16. values folder. This is where your string (text) definitions are stored. To support multiple languages you would find a values folder per language, for example values-fr.
  17. strings.xml. A standard XML file containing named string definitions.
  18. AndroidManifest.xml - The hub of your project containing the details on the Activities, Permissions within your app.
  19. default.properties -An auto-generated configuration file storing the basic project properties.
  20. proguard.cfg - ProGuard can be used to obfuscate your code to prevent nasty code thieves from stealing your secrets. By default this is not applied to the code but the configuration file is still present.
Typically you will place any additional referenced Java libraries (.jar files) into a libs folder.

Hopefully this will help an Android newbie opening up a new project for the first time.

1 comments:

Meghna said...

Simple and superb explanation.. Even this http://www.compiletimeerror.com/2013/01/directorystructure-of-android-project.html might help.. Have a look..

Post a Comment