揭秘Android Studio项目目录结构
I don't know if this is because of the Gradle Build System (I'd wager it is), but I'll tell you what I've understood so far. Update 1: 29/7/13 The IntelliJ's
Project structure (shown at the end) is for IntelliJ with the android plugin. The Android Studio, however, has a project structure divided like so:
Update 2: 07/04/14
Structure: Projects and Modules
module in Android Studio is like a project in Eclipse
project in Android Studio is like a workspace in Eclipse
From the documentation (Android
Studio is based on Intellij IDEA) :
Whatever you do in IntelliJ IDEA, you do that in the context of a project. A project is an organizational unit that represents a complete software solution.
Your finished product may be decomposed into a series of discrete, isolated modules, but it's a project definition that brings them together and ties them into a greater whole.
For Android, it means one project per app, and one module per library and per test app.
There are multiple issues if you try to build multiple apps within the same project. It's possible, but if you try (like I did), you will see that almost everything is designed to work with a single app per project.
For example, there is an option to "rebuild the project", which makes no sense with multiple apps, many other project settings would be useless, and the built-in VCS system isn't great when you have multiple repositories.
Structure: Folder Structure
Top Level Folders
1. Main Project
This would be entire project context (Eclipse Land: Like
your workspace but limited to what's relevant to your project). Ex: HelloWorldProject
if
the name of the application you gave was HelloWorld
2. .idea
This where project specific metadata is stored by Android Studio (AS). (Eclipse Land: project.properties
file)
3. Project Module
This is the actual project. ex: HelloWorld
if
your application name you gave was HelloWorld
4. gradle
This is where the gradle build system's jar wrapper i.e. this jar is how AS communicates with gradle installed in Windows (the OS in my case).
5. External Libraries
This is not actually a folder but a place where Referenced Libraries (Eclipse Land: Referenced Libraries) are shown. Here's where the Targeted Platform
is shown etc.
[Side note: This where many of us in Eclipse Land used to delete the referenced libraries and Fix Project Properties to fix reference errors, remember?]
Project Folder in Detail
This is number #3 in the above list. Has the following sub dirs
1. build
This has all the complete output of the make
process
i.e. classes.dex, compiled classes and resources, etc.
In the Android Studio GUI, only a few folders are shown. The important part is that your R.java is found here under build/source/<flavor>/r/<build
type(optional)>/<package>/R.java
2. libs
This is the standard libs folder that you see in eclipse land too
3. src
Here, you only see the java
and res
folder
which correspond to the src
folder
and res
folder
inEclipse Land. This is much welcomed simplification IMHO.
Note on Modules:
Modules are like Eclipse Land projects. Here the idea is that you have one application project (Module #3 in the list above) and several library projects(as
separate Modules under the global project folder (#1 in the above list)) which the application project depends on. How these library projects can be re-used in other applications, I still haven't found out.
[Side note: The whole re-organization has some benefits like simplifications in src folder, but so many complications. The complications are mainly due VERY
VERY thin documentation on this new project layout.]
The New Build System
User Guide for the new Build System
I'll probably update this section once I myself get it.
Compare this with Intellij's
Project Structure if that helps:
The .idea (1) folder contains a number of subfolders, mainly with internal IntelliJ IDEA information.
The src (2) folder contains the MyActivity.java (3)
file source code that implements the functionality of your application. The file belongs to the com.example package.
The res (4) folder contains various visual resources.
The layout/main.xml file (5) defines the appearance of the application constituted of resources of various types.
The values folder (6) is intended for storing .xml files that describe resources of various types. Presently, the folder contains a strings.xml file with
String resources definitions. As you will see from the Adding a Color section, the layout folder can also contain, for example, a descriptor of colors.
The drawable folder (7) contains images.
The gen (8) folder contains the R.java (9) file
that links the visual resources and the Java source code. As you will see from the sections below, IntelliJ IDEA supports tight integration between static resources and R.java. As soon as any resources are added or removed, the corresponding classes and class
fields in R.java are automatically generated or removed accordingly. The R.java file also belongs to the com.example package.
揭秘Android Studio项目目录结构的更多相关文章
- 【Android Studio安装部署系列】三、Android Studio项目目录结构
版权声明:本文为HaiyuKing原创文章,转载请注明出处! 概述 简单介绍下Android studio新建项目的目录结构. 常用项目结构类型 在Android Studio中,提供了以下几种项目结 ...
- Android开发学习之路--Android Studio项目目录结构简介
既然已经搭建好环境了,那就对Android Studio中项目目录结构做个简单的了解了,这里以最简单的Hello工程为例子,新建好工程后看如下三个工程视图: 1.Android工程 manifests ...
- Android Studio项目目录结构介绍——android菜鸟成长之路
在Android Studio中,提供了以下几种项目结构类型 我们一般常用的有以下两种结构: Project 结构类型 app/build/ app模块build编译输出的目录 app/build.g ...
- Android Studio项目目录结构介绍
在Android Studio中,提供了以下几种项目结构类型 我们一般常用的有以下两种结构: Project 结构类型 app/build/ app模块build编译输出的目录 app/build.g ...
- Android Studio项目目录结构
在Android Studio中,提供了以下几种项目结构类型 我们一般常用的有以下两种结构: Project 结构类型 app/build/ app模块build编译输出的目录 app/build.g ...
- Android Studio 项目目录结构 英文版
I don't know if this is because of the Gradle Build System (I'd wager it is), but I'll tell you what ...
- android studio学习----目录结构
项目结构:一个窗口只有一个项目,项目 叫 Project 代表一个workspace 一个项目的结构跟eclipse区别还是蛮大的: 首先看APP结构:app放的其实就是 java文件和资源文件 ...
- Android Studio工程目录介绍
来自知乎: Android Studio工程目录结构 .gradle 是gradle运行以后生成的缓存文件夹. .idea 是android studio/Intellij IDEA工程打开以后生成的 ...
- Android Studio项目结构
我们创建了一个Android Project,打开就如下图所示: 我们选择Project视图,就会有以下的项目文档结构: 上面笔者标注的数字是接下来要讲解的内容. 我们先来看1: 我们创建Appl ...
随机推荐
- python网络编程-Json序列化功能扩展-软件开发架构-OSI七层协议-TCP-01
面向对象补充知识点(面向对象的应用) 扩展json序列化所支持的数据类型(分析源码) import json from datetime import datetime, date # ------- ...
- 分布式的几件小事(六)dubbo如何做服务治理、服务降级以及重试
1.服务治理 服务治理主要作用是改变运行时服务的行为和选址逻辑,达到限流,权重配置等目的. ①调用链路自动生成 一个大型的分布式系统,会由大量的服务组成,那么这些服务之间的依赖关系和调用链路会很复杂, ...
- 07 Python中zip(),map(),filter(),reduce()用法
一. zip() zip() 函数用于将可迭代的对象作为参数,将对象中对应的元素打包成一个个元组,然后返回由这些元组组成的列表. 如果各个迭代器的元素个数不一致,则返回列表长度与最短的对象相同,利用 ...
- 防抖与节流函数<转>
参考连接:https://www.cnblogs.com/zhuanzhuanfe/p/10633019.html https://blog.csdn.net/Beijiyang999/article ...
- 三种Shell脚本编程中避免SFTP输入密码的方法
最近编程中用到sftp上传文件,且需要用crontab预设定时上传事件.而sftp不同于ftp,没有提供选项如 -i 可以将密码直接编码进程序.使用sftp指令,会自动请求用户输入密码. 总结一下可以 ...
- C与汇编混合编程
C中调用汇编,要把汇编定义为全局的,加.global C内嵌汇编 __asm__( :汇编语句部分 :输出部分 :输入部分 :破坏描述部分 ); 用C内嵌汇编的方式:实现LED的点亮 //#defin ...
- cgicc使用
CgiCc 使用 一.下载 下载地址: http://ftp.gnu.org/gnu/cgicc/ ftp://ftp.gnu.org/gnu/cgicc/ 二.配置.编译.安装 下载完成后解压:sh ...
- 测试人员必备:linux文件清理不得不知道的技巧
测试人员最常见和繁琐的任务之一就是清理系统,比如防止磁盘空间出现不足.下面是我收集的一些常用的 Linux 文件系统相关命令. 一 检查可用空间 要查找服务器上所有文件系统上的可用空间,请执行以下命令 ...
- 【转】Java的四种代码块
原贴地址:http://www.cnblogs.com/end/archive/2012/12/21/2827554.html 一.普通代码块 直接在一个方法中出现的{}就称为普通代码块,例子程序如下 ...
- 【AGC005 F】Many Easy Problems
神他吗一天考一道码农题两道 FFT(其实还是我推式子一窍不通) 题意 给你一棵 \(n\) 个点的树,再给你一个常数 \(k\). 设 \(S\) 为树上某些点的集合,定义 \(f(S)\) 为最小的 ...