• Android Studio主要目录及文件简介


    都是贴的,以后等真正搞明白再整理

    build:构建目录,相当于Eclipse中默认Java工程的bin目录。 
    libs:依赖包 
    src: 
        main 
            java Java代码 
            res 资源文件 
                layout App布局及界面元素配置 
                menu App菜单配置 
                values 
                    dimens.xml 定义css的配置文件 
                    strings.xml 定义字符串的配置文件 
                    styles.xml 定义style的配置文件 
            AndroidManifest.xml App基本信息(名称、版本、SDK、权限等等) 
            ic_launcher-web.png App图标 
    build.gradle:Gradle构建脚本

    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

    Android Studio Project 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:

    Intellij Project Structure Snapshot

    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.

  • 相关阅读:
    Redis总结
    设计模式-单例模式
    spring5源码解读
    关于asp.net MVC 中的TryUpdateModel方法
    WebSocket在ASP.NET MVC4中的简单实现 (该文章转自网络,经尝试并未实现,请大神指点。)
    C# 新特性 dynamic的使用及扩展
    C#用反射判断一个类型是否是Nullable同时获取它的根类型(转自网络)
    C#通用类型转换 Convert.ChangeType 转自网络
    浅谈.NET反射机制的性能优化 转自网络 博客园
    浅析大型网站的架构 转自软件中国
  • 原文地址:https://www.cnblogs.com/tianxizi/p/4461541.html
Copyright © 2020-2023  润新知