It is important to recognize the Android directory structure. Like words are as important as learning a language. In the future to learn the Android kernel source code, but also the first need to familiarize themselves with the Android source directory structure. Just start to learn the directory structure, naturally there may be more boring, which can be constantly familiar at the time, the continuous summary as the name implies (SRC, source code) The folder is put project source code. Opening the Helloworld.java file will see the following code:.
The simplest HelloWorld application directory structure:
1,SRC directory:
Src:source Code The folder is the source code for the project. Opening the Helloworld.java file will see the following code:
1 Packagehelloworld.test;2 3 Importandroid.app.Activity;4 ImportAndroid.os.Bundle;5 6 Public classHelloWorldextendsActivity {7 /**Called when the activity is first created.*/8 @Override9 Public voidonCreate (Bundle savedinstancestate) {Ten Super. OnCreate (savedinstancestate); One Setcontentview (r.layout.main); A } -}
This helloworld.java is the entrance to the application that we refer to ourselves often.
2,gen directory:
There is a R.java file under the folder, and R.java is generated automatically when you build the project. The R.java file defines a class--r,r class that contains many static classes, and the name of the static class corresponds to a name in Res, which is the R class that defines the index of all resources for the project.
3,assets directory:
You need to package the resource files (non-code) into the application, such as MP3, video class files, and so on.
4,res directory:
Resource folders, such as the string resources that your application requires, layout file resources, and so on, such as layout files:
1 <?xml version= "1.0" encoding= "Utf-8"?> 2 <linearlayout xmlns:android= "/http Schemas.android.com/apk/res/android " 3 android:orientation=" Vertical " 4 android:layout _width= "Fill_parent" 5 android:layout_height= "Fill_parent" 6 > 7 < TextView 8 9 android:text= "@string/hello"11 /> </LinearLayout>
5, configuration file Androidmanifext.xml:
This file is the most important, documenting the various components used in the application. The equivalent of the application contains the declaration of the various functions, when the Android run, will read the file, and then execute the corresponding components inside.
1<?xml version= "1.0" encoding= "Utf-8"?>2<manifest xmlns:android= "Http://schemas.android.com/apk/res/android"3 Package= "Helloworld.test"4Android:versioncode= "1"5Android:versionname= "1.0" >6<application android:icon= "@drawable/icon" android:label= "@string/app_name" >7<activity android:name= ". HelloWorld "8Android:label= "@string/app_name" >9<intent-filter>Ten<action android:name= "Android.intent.action.MAIN"/> One<category android:name= "Android.intent.category.LAUNCHER"/> A</intent-filter> -</activity> -</application> the</manifest>
6,bin directory:
After we execute our code, we will generate the corresponding executable file in the bin directory, we go to this directory to fetch the corresponding apk.
Initial knowledge of the simplest Android application directory structure