Android 开发各种项目的结构
Android Projects
An Android project is the container for your application's source code, resource files, and files such as the Ant build and Android Manifest file. An application project is the main type of project and the contents are eventually built into an .apk
file that you install on a device.
Test Projects
These projects contain code to test your application projects and are built into applications that run on a device.(测试项目用来测试你的项目)
Library Projects
These projects contain shareable Android source code and resources that you can reference in Android projects. This is useful when you have common code that you want to reuse. Library projects cannot be installed onto a device, however, they are pulled into the .apk
file at build time.(库项目不会被安装到设备之中,只会被打包到apk文件之中。)
Android Projects
Contains your stub Activity file, which is stored at src/your/package/namespace/ActivityName.java
. All other source code files (such as .java
or .aidl
files) go here as well.
bin/
Output directory of the build. This is where you can find the final .apk
file and other compiled resources.
jni/
Contains native code sources developed using the Android NDK. For more information, see the Android NDK documentation.
gen/
Contains the Java files generated by ADT, such as your R.java
file and interfaces created from AIDL file
assets/
This is empty. You can use it to store raw asset files. Files that you save here are compiled into an .apk
file as-is, and the original filename is preserved. You can navigate this directory in the same way as a typical file system using URIs and read files as a stream of bytes using the AssetManager
. For example, this is a good location for textures and game data.
res/
Contains application resources, such as drawable files, layout files, and string values. See Application Resources for more information.
anim/
color/
anim/
anim/
layout/
menu/
raw/
assets/
directory only differs in the way that you access them(和assets/目录的不同之处就是 访问资源的方法不同). These files are processed by aapt and must be referenced from the application using a resource identifier in the
R
class(使用aapt来处理,并通过R.来引用). For example, this is a good place for media, such as MP3 or Ogg files.
values/
res/
directory, resources written to XML files in this folder are not referenced by the file name. Instead, the XML element type controls how the resources is defined within them are placed into the
R
class.
xml/
PreferenceScreen
,
AppWidgetProviderInfo
, or
Searchability Metadata. See
Application Resources for more information about configuring these application components.
libs/
AndroidManifest.xml
project.properties
local.properties
local.properties
should not be maintained in a source revision control system. If you use Eclipse, this file is not used.
ant.properties
build.xml
anim/
color/