android studio 项目结构必知
来源:互联网 发布:智取数字3软件 编辑:程序博客网 时间:2024/06/14 01:40
android studio 可以切换浏览模式,有:
不同模式下,显示不同的列表视图文件。
但是本质都是一样的,只是显示分类不同。
这里我们选择“Android”进行说明。
1)android studio一个项目对应一个窗口;
Eclipse中的WorkSpace相当于Studio中的Project.
2)
build.gradle (project: 项目名)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath ‘com.android.tools.build:gradle:2.1.2’
// NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这个对应过程的下载库的地址。 jcenter()
公用的依赖库
classpath ‘com.android.tools.build:gradle:2.1.2’
该gradle-2.1.2.jar包,项目先从本地studio安装目录下仓库中查找是否存在,我的目录:
E:\Program Files\Android\Android Studio\gradle\m2repository\com\android\tools\build\gradle
我本地仓库中有这个2.1.2的jar包,所以不需要从远程服务器下载。
如果你本地没有2.1.2版本,那么studio会自动下载,下载目录:
C:\Users\lihui20.gradle\caches\modules-2\files-2.1\
下回下载配置文件中的各类jar包(前提本地仓库没有)
3)build.gradle(Module:app)
Eclipse中的Project相当于AS中的Module(只就新建而言)。
apply plugin: ‘com.android.application’
android {
compileSdkVersion 24
buildToolsVersion “24.0.3”
defaultConfig { applicationId "com.example.lihui20.myapplication" minSdkVersion 10 targetSdkVersion 24 versionCode 1 versionName "1.0"}buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' }}
}
dependencies {
compile fileTree(dir: ‘libs’, include: [‘*.jar’])
testCompile ‘junit:junit:4.12’
compile ‘com.android.support:appcompat-v7:24.2.1’
}
这里面都当前项目的配置。
compileSdkVersion 24
编译的sdk版本;
buildToolsVersion “24.0.3”
sdk中下载的工具;
compile fileTree(dir: ‘libs’, include: [‘*.jar’])
testCompile ‘junit:junit:4.12’
compile ‘com.android.support:appcompat-v7:24.2.1’
项目依赖的jar包和库library
4)gradle.properties(Global properties)
全局配置文件。
C:\Users\lihui20.gradle\gradle.properties
ject-wide Gradle settings.
IDE (e.g. Android Studio) users:
Settings specified in this file will override any Gradle settings
configured through the IDE.
For more details on how to configure your build environment visit
http://www.gradle.org/docs/current/userguide/build_environment.html
The Gradle daemon aims to improve the startup and execution time of Gradle.
When set to true the Gradle daemon is to run the build.
TODO: disable daemon on CI, since builds should be clean and reliable on servers
org.gradle.daemon=true
Specifies the JVM arguments used for the daemon process.
The setting is particularly useful for tweaking memory settings.
Default value: -Xmx10248m -XX:MaxPermSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
When configured, Gradle will run in incubating parallel mode.
This option should only be used with decoupled projects. More details, visit
http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true
Enables new incubating mode that makes Gradle selective when configuring projects.
Only relevant projects are configured which results in faster builds for large multi-projects.
http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:configuration_on_demand
org.gradle.configureondemand=true
注意:
配置org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m
项目的内存 大小。
C:\Users\lihui20.gradle\gradle.properties
5)gradle.properties(project properties)
C:\Users\lihui20\Desktop\MyApplication\gradle.properties
Project-wide Gradle settings.
IDE (e.g. Android Studio) users:
Gradle settings configured through the IDE will override
any settings specified in this file.
For more details on how to configure your build environment visit
http://www.gradle.org/docs/current/userguide/build_environment.html
Specifies the JVM arguments used for the daemon process.
The setting is particularly useful for tweaking memory settings.
Default value: -Xmx10248m -XX:MaxPermSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
When configured, Gradle will run in incubating parallel mode.
This option should only be used with decoupled projects. More details, visit
http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true
全部注释掉了,使用默认的配置
6)settings.gradle
C:\Users\lihui20\Desktop\MyApplication\settings.gradle
include ‘:app’
7)local.properties
C:\Users\lihui20\Desktop\MyApplication\local.properties
sdk.dir=C:\Users\lihui20\AppData\Local\Android\Sdk
sdk路径,可以自己指定。
记录:
sdk下载的library库 以及 jar包
E:\AndroidStudio\Local\Android\sdk\extras
studio自带的库:
E:\Program Files\Android\Android Studio\gradle\m2repository
studio自带的gradle 版本:
E:\Program Files\Android\Android Studio\gradle\gradle-2.10
本地库没有的jar包或者library,远程服务器下载:
C:\Users\lihui20.gradle\caches\modules-2\files-2.1
- android studio 项目结构必知
- Android Studio项目结构
- Android Studio 项目结构
- android studio 项目结构
- Android Studio项目结构
- Android Studio项目结构
- Android Studio 项目基本结构
- Android studio Gradle项目结构
- Android Studio 项目目录结构
- Android Studio项目目录结构
- Android Studio 项目结构解析
- Android Studio项目目录结构
- 掌握android studio项目结构
- android studio的项目结构
- android studio 项目结构 汉化
- 初识android studio项目结构
- Android项目Android Studio目录结构
- 揭秘Android Studio项目目录结构
- 第13周项目5 拓扑排序算法验证
- Android AddManager浅析
- maven打包出现maven-resources-plugin:2.6:resources (default-resources)的解决
- 关于前台合并获取后台动态table中数据相同的单元格的问题;th td合并
- 第十二周项目5-迷宫问题之图深度优先遍历解法
- android studio 项目结构必知
- 数据解析
- 第十三周项目1-floyd算法
- css总结
- java.lang.IllegalStateException异常产生的原因及解决办法
- JS 对象(Object)和字符串(String)互转
- Java学习记录(14)——Annotation
- **将存放在首地址为buf、长度为3B的数据联合左移2位。例如,左移前为88 88 88H,左移后应为22 22 20H。** * > 联合移位操作
- Squid代理服务器