Via : OpenAndroid.in
Tags : #Andoird, #Tutorial
Orginal Post: Android Project Structure
Part 0: Getting Started
This series of Android tutorials is meant to help you build the skills and confidence necessary to build real, quality Android apps. This tutorial is for the Java developer just getting started learning Android app development, who is somewhat familiar with Eclipse and has installed the Android SDK and the Android Developer Plugin for Eclipse. If you are not prepared, see the previous tutorials in this series.
Part 1: Create a Basic Hello World App
If you have not created a Hello World app yet, do so now. If you need help with this step, see our previous tutorial Creating Android Hello World Applications to learn how.
Step 1: Expand the Package Explorer
Within Eclipse in the Java perspective, you should see your project displayed in the Package Explorer pane on the left-hand side of the screen. For the purposes of this tutorial, we have created a simple Hello World app whose project is called BasicHelloWorld.
Step 2: Explore the /src Directory
The /src folder contains the Java source files associated with your project. For example, the Activity class called MainActivity.java is stored in this directory under the package name you specified in the Android project wizard. This MainActivity class provides all the application code associated with the Hello World app.
You will want to keep these files in source control.
Step 3: Explore the /gen Directory
The /gen folder contains the Java source files and other code files generated by Eclipse that are associated with your project. Do not edit these files directly. For example, the R.java file is a file generated to link your resource files (as defined in the /res directory structure) for use in your /src Java files.
You will not need to keep these files in source control. They are recreated whenever you add resources to your project or recompile your project. Make sure they are always writeable or you will run into problems.
Step 4: Explore the Android Directories
After the /src and /gen directories, you will see one or more libraries linked to your project. In this example, we are building against Android 4.1, so you see this version of the android.jar file linked to the project. Next, you see that we have also linked an Android Dependency to the Android Support library for backwards compatibility with previous versions of the Android SDK.
You will not need to keep these files in source control.
Step 5: Explore the /assets Directory
The /assets folder contains any uncompiled source files associated with your project. Most files are compiled into your project as resources. However, there are some kinds of files that you want to include in your projects as-is, like GL textures.
You will want to keep these files in source control.
Step 6: Explore the /bin Directory
The /bin folder contains the resulting application package files associated with your project once it’s been built. Package files, or apks, are the deliverable that you actually install onto an Android device.
You may want to keep these files in source control, but only if you want to keep the final apks that result from building your application successfully. These files are best kept outside the project source tree, as numbered builds, for use by quality assurance personnel, etc. Additionally, even if they are in source control, you’ll want them writable to avoid problems during compilation. Alternately, you could store them in a separate version tracked location that is accessible to other members of your team.
Step 7: Explore the /libs Directory
The /libs folder contains any secondary libraries (jars) you might want to link to your app.
You will want to keep these files in source control.
Step 8: Explore the /res Directory
The /res folder contains the resource files associated with your project. All graphics, strings, layouts, and other resource files are stored in the resource file hierarchy under the /res directory. Different types of resources are stored in different directories. For example, graphics are stored under the /drawable directory tag, while strings and other primitives are stored under the /values directory tag. User interface resources are stored in the /layout directory. Special tags often follow the directory tag name to organize resources further by screen type, Android version, and other device details.
You will want to keep these files in source control.
Step 9: Explore AndroidManifest.xml
The AndroidManifest.xml file is a very important configuration file that your application is required to have. This file is used to specify everything about your application from the app’s name and icon to the Activity class files used and the permissions your application needs to run, among many other details.
You will want to keep this file in source control.
Step 10: Explore proguard-project.txt
The proguard-project.txt file is generated by the Android project wizard. This file is used to configure the ProGuard settings associated with your project. ProGuard is a tool that can be used to help protect your code from software piracy using obfuscation and code optimization. Developers usually edit this file only once their application is sufficiently mature to consider deploying it outside the company–as a beta or for release. To find out more about ProGuard for Android and how it can help keep your app code from being reverse engineered, see the Android docs for Proguard.
You will want to keep this file in source control.
Step 11: Explore project.properties
The project.properties file is generated by the Android project wizard. This file is used to configure the Eclipse project settings. Developers rarely, if ever, need to edit this file directly. Instead, right click on the project in Eclipse, choose properties, and make any changes necessary using the Eclipse UI.
You will want to keep this file in source control.
Via : OpenAndroid.in
Tags : #Andoird, #Tutorial
Orginal Post: Android Project Structure
0 comments:
Post a Comment