├── 031_simple_build_files.md ├── 11_goals_of_the_new_build_system.md ├── README.md ├── SUMMARY.md ├── _book ├── 031_simple_build_files.html ├── 11_goals_of_the_new_build_system.html ├── GLOSSARY.html ├── aapt_options.html ├── advanced_build_customization.html ├── android_tasks.html ├── basic_build_customization.html ├── basics_and_configuration.html ├── build_options.html ├── build_tasks.html ├── build_types.html ├── build_variants.html ├── building_and_tasks.html ├── buildtype_and_product_flavor_property_reference.html ├── configuring_the_structure.html ├── cover.jpg ├── cover_small.jpg ├── creating_a_library_project.html ├── dependencies,_android_libraries_and_multi-project_setup.html ├── dependencies_on_binary_packages.html ├── dex_options.html ├── differences_between_a_project_and_a_library_project.html ├── general_tasks.html ├── gitbook │ ├── app.js │ ├── fonts │ │ ├── fontawesome │ │ │ ├── FontAwesome.otf │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.svg │ │ │ ├── fontawesome-webfont.ttf │ │ │ └── fontawesome-webfont.woff │ │ ├── merriweather │ │ │ ├── 250.woff │ │ │ ├── 250i.woff │ │ │ ├── 400.woff │ │ │ ├── 400i.woff │ │ │ ├── 700.woff │ │ │ ├── 700i.woff │ │ │ ├── 900.woff │ │ │ └── 900i.woff │ │ └── opensans │ │ │ ├── 300.woff │ │ │ ├── 300i.woff │ │ │ ├── 400.woff │ │ │ ├── 400i.woff │ │ │ ├── 600.woff │ │ │ ├── 600i.woff │ │ │ ├── 700.woff │ │ │ └── 700i.woff │ ├── images │ │ ├── apple-touch-icon-precomposed-152.png │ │ └── favicon.ico │ ├── plugins │ │ └── gitbook-plugin-mathjax │ │ │ └── plugin.js │ ├── print.css │ └── style.css ├── glossary_index.json ├── goals_of_the_new_build_system.html ├── index.html ├── java_compilation_options.html ├── java_project_tasks.html ├── library_projects.html ├── library_publication.html ├── lint_support.html ├── local_packages.html ├── manifest_entries.html ├── manipulating_tasks.html ├── multi-flavor_variants.html ├── multi-projects_reports.html ├── multi_project_setup.html ├── product_flavor_configuration.html ├── product_flavors.html ├── project_structure.html ├── publish.sh ├── referencing_a_library.html ├── remote_artifacts.html ├── req.html ├── requirements.html ├── running_proguard.html ├── running_tests.html ├── search_index.json ├── signing_configurations.html ├── single_projects.html ├── sourcesets_and_dependencies.html ├── test_reports.html ├── testing.html ├── testing_android_libraries.html ├── using_sourcecompatibility_17.html └── why_gradle.html ├── aapt_options.md ├── advanced_build_customization.md ├── android_tasks.md ├── basic_build_customization.md ├── basics_and_configuration.md ├── build_options.md ├── build_tasks.md ├── build_type_+_product_flavor_=_build_variant.md ├── build_types.md ├── build_variants.md ├── building_and_tasks.md ├── buildtype_and_product_flavor_property_reference.md ├── configuring_the_structure.md ├── cover.jpg ├── cover_small.jpg ├── creating_a_library_project.md ├── dependencies,_android_libraries_and_multi-project_setup.md ├── dependencies_on_binary_packages.md ├── dex_options.md ├── differences_between_a_project_and_a_library_project.md ├── general_tasks.md ├── goals_of_the_new_build_system.md ├── java_compilation_options.md ├── java_project_tasks.md ├── library_projects.md ├── library_publication.md ├── lint_support.md ├── local_packages.md ├── manifest_entries.md ├── manipulating_tasks.md ├── multi-flavor_variants.md ├── multi-projects_reports.md ├── multi_project_setup.md ├── product_flavor_configuration.md ├── product_flavors.md ├── project_structure.md ├── publish.sh ├── referencing_a_library.md ├── remote_artifacts.md ├── req.md ├── requirements.md ├── running_proguard.md ├── running_tests.md ├── signing_configurations.md ├── single_projects.md ├── sourcesets_and_dependencies.md ├── test_reports.md ├── testing.md ├── testing_android_libraries.md ├── using_sourcecompatibility_17.md └── why_gradle.md /031_simple_build_files.md: -------------------------------------------------------------------------------- 1 | # 简单构建文件 2 | 一个最简单Gradle纯Java工程的build.gradle文件包含了以下内容: 3 | ``` groovy 4 | apply plugin: 'java' 5 | ``` 6 | 这是Gradle包装的Java插件。该插件提供了所有构建和测试Java应用程序的东西。 7 | 最简单的Android工程的build.gradle描述: 8 | ``` groovy 9 | buildscript { 10 | repositories { 11 | mavenCentral() 12 | } 13 | 14 | dependencies { 15 | classpath 'com.android.tools.build:gradle:0.11.1' 16 | } 17 | } 18 | 19 | apply plugin: 'android' 20 | 21 | android { 22 | compileSdkVersion 19 23 | buildToolsVersion "19.0.0" 24 | } 25 | ``` 26 | 译者注:目前gradle tools版本为0.13.+(2014.10.08) 27 | 28 | 上述内容包含了Android构建文件的3个主要部分: 29 | 30 | **buildscript { ... }**配置了驱动构建的代码. 31 | 32 | 在这个例子中,他申明了使用Maven中央库,并且申明了一个Maven构件的依赖classpath。这个构件声明了Gradle的Android插件版本为0.11.1. 33 | 34 | **注意**:这里的配置只影响了构建过程的代码,而不是整个工程的代码.工程本身需要声明它自己的仓库和依赖.这个后面会提到. 35 | 36 | 然后,跟前面提到的Java插件一样,添加了**android**插件. 37 | 38 | 最后,**android { ... }**配置了所有android构建的参数.也是Android DSL的入口点. 39 | 默认情况下,只有编译的target和build-tools版本是必须的.就是**compileSdkVersion**和**buildtoolsVersion **两个属性. 40 | 编译的target属性相当于在老的构建系统中`project.properties`中的target属性.这个新属性和老的target属性一样可以指定一个int(api等级)或者string类型的值. 41 | 42 | **重要:** 你只能使用**android**插件.如果同时使用**java**插件,会导致构建错误. 43 | 44 | **注意:** 你还需要添加*local.properties*文件,使用**sdk.dir**属性,来设置已经存在的SDK路径. 45 | 另外,你也可以设置环境变量**ANDROID_HOME**.这两种方式没有什么区别,可以根据你自己的喜好来选择一种. 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /11_goals_of_the_new_build_system.md: -------------------------------------------------------------------------------- 1 | # 简介 2 | 本文档适用于0.9版本的Gradle plugin。在我们引入1.0版本之前,内容可能会与之前的版本不兼容。 3 | 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 说明 2 | Gradle Plugin User Guide中文版 3 | ======================== 4 | [](https://www.gitbook.io/book/yeungeek/gradle-plugin-user-guide/activity) 5 | 6 | Gradle Plugin的使用,并结合例子说明 7 | 8 | * Gradle Plugin User Guide中文版 正在翻译当中 欢迎大家一起加入 9 | * github: https://github.com/yeungeek/GradlePlugin_UserGuide 10 | * 使用了gitbook进行编辑:http://yeungeek.gitbooks.io/gradle-plugin-user-guide/ 11 | * 原文地址:http://tools.android.com/tech-docs/new-build-system/user-guide 12 | * 我会开放权限给需要加入的同学,联系我: yeungeek#gmail.com 13 | 14 | **翻译进度** 15 | 16 | 章节| 时间 | 译者|实例 17 | ----|------|----|---- 18 | 1 | 14.09.29 | [yeungeek](https://github.com/yeungeek)|[HelloWorld](https://github.com/yeungeek/Android-Gradle-Samples/tree/master/HelloWorld) 19 | 2 | 14.09.29 | [yeungeek](https://github.com/yeungeek)|- 20 | 3.1 | 14.10.08 | [yeungeek](https://github.com/yeungeek)| 21 | 3.2 | 14.10.09 | [yeungeek](https://github.com/yeungeek)| 22 | 3.3 | 14.10.10 | [yeungeek](https://github.com/yeungeek)| 23 | 3.4 | 14.10.20 | [yeungeek](https://github.com/yeungeek)| 24 | 4.1 | 14.11.03 | [yeungeek](https://github.com/yeungeek)| 25 | 4.2 | 14.11.05 | [yeungeek](https://github.com/yeungeek)| 26 | 4.3 | 14.12.01 | [flyouting](https://github.com/flyouting)| 27 | 5.1 | 15.05.01 | [yeungeek](https://github.com/yeungeek)| 28 | 5.2 | 15.05.02 | [yeungeek](https://github.com/yeungeek)| 29 | 5.3 | 15.05.02 | [yeungeek](https://github.com/yeungeek)| 30 | 5.4 | 15.05.04 | [yeungeek](https://github.com/yeungeek)| 31 | 5.5 | 15.05.05 | [yeungeek](https://github.com/yeungeek)| 32 | 6 | 15.06.21 | [yeungeek](https://github.com/yeungeek)| 33 | 7 | 15.06.22 | [yeungeek](https://github.com/yeungeek)| 34 | 35 | **特色** 36 | 37 | 我们是有实例的人 38 | 39 | gradle对应的示例代码,可以fork [Samples](https://github.com/yeungeek/Android-Gradle-Samples). 40 | 41 | # Summary 42 | 43 | * [序言](README.md) 44 | * [简介](11_goals_of_the_new_build_system.md) 45 | * [新构建系统的目标](goals_of_the_new_build_system.md) 46 | * [为什么使用Gradle?](why_gradle.md) 47 | * [配置](req.md) 48 | * [基础工程](requirements.md) 49 | * [简单构建文件](031_simple_build_files.md) 50 | * [工程结构](project_structure.md) 51 | * [配置工程结构](configuring_the_structure.md) 52 | * [构建任务](build_tasks.md) 53 | * [通用任务](general_tasks.md) 54 | * [Java工程任务](java_project_tasks.md) 55 | * [Android任务](android_tasks.md) 56 | * [基本的构建自定义](basic_build_customization.md) 57 | * [Manifest属性](manifest_entries.md) 58 | * [构建类型](build_types.md) 59 | * [签名配置](signing_configurations.md) 60 | * [运行ProGuard](running_proguard.md) 61 | * [依赖,Android库和多项目设置](dependencies,_android_libraries_and_multi-project_setup.md) 62 | * [依赖二进制包](dependencies_on_binary_packages.md) 63 | * [本地包](local_packages.md) 64 | * [远程文件](remote_artifacts.md) 65 | * [多项目设置](multi_project_setup.md) 66 | * [库工程](library_projects.md) 67 | * [创建一个库工程](creating_a_library_project.md) 68 | * [普通项目和库项目的区别](differences_between_a_project_and_a_library_project.md) 69 | * [引用一个库工程](referencing_a_library.md) 70 | * [库工程发布](library_publication.md) 71 | * [测试](testing.md) 72 | * [基本原理和配置](basics_and_configuration.md) 73 | * [运行测试](running_tests.md) 74 | * [测试Android库工程](testing_android_libraries.md) 75 | * [测试报告](test_reports.md) 76 | * [独立工程](single_projects.md) 77 | * [多工程报告](multi-projects_reports.md) 78 | * [Lint支持](lint_support.md) 79 | * [构建变种版本](build_variants.md) 80 | * [产物定制](product_flavors.md) 81 | * [构建类型+产物定制=构建变种版本](build_type_+_product_flavor_=_build_variant) 82 | * [产物定制配置](product_flavor_configuration.md) 83 | * [源组件和依赖](sourcesets_and_dependencies.md) 84 | * [构建和任务](building_and_tasks.md) 85 | * [测试](testing.md) 86 | * [多定制的变种版本](multi-flavor_variants.md) 87 | * [高级构建的自定义](advanced_build_customization.md) 88 | * [构建选项](build_options.md) 89 | * [Java编译选项](java_compilation_options.md) 90 | * [aapt选项](aapt_options.md) 91 | * [dex选项](dex_options.md) 92 | * [操作tasks](manipulating_tasks.md) 93 | * [构建类型和产物定制的属性引用](buildtype_and_product_flavor_property_reference.md) 94 | * [使用sourceCompatibility 1.7](using_sourcecompatibility_17.md) 95 | -------------------------------------------------------------------------------- /SUMMARY.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | * [序言](README.md) 4 | * [简介](11_goals_of_the_new_build_system.md) 5 | * [新构建系统的目标](goals_of_the_new_build_system.md) 6 | * [为什么使用Gradle?](why_gradle.md) 7 | * [配置](req.md) 8 | * [基础工程](requirements.md) 9 | * [简单构建文件](031_simple_build_files.md) 10 | * [工程结构](project_structure.md) 11 | * [配置工程结构](configuring_the_structure.md) 12 | * [构建任务](build_tasks.md) 13 | * [通用任务](general_tasks.md) 14 | * [Java工程任务](java_project_tasks.md) 15 | * [Android任务](android_tasks.md) 16 | * [基本的构建自定义](basic_build_customization.md) 17 | * [Manifest属性](manifest_entries.md) 18 | * [构建类型](build_types.md) 19 | * [签名配置](signing_configurations.md) 20 | * [运行ProGuard](running_proguard.md) 21 | * [依赖,Android库和多项目设置](dependencies,_android_libraries_and_multi-project_setup.md) 22 | * [依赖二进制包](dependencies_on_binary_packages.md) 23 | * [本地包](local_packages.md) 24 | * [远程文件](remote_artifacts.md) 25 | * [多项目设置](multi_project_setup.md) 26 | * [库工程](library_projects.md) 27 | * [创建一个库工程](creating_a_library_project.md) 28 | * [普通项目和库项目的区别](differences_between_a_project_and_a_library_project.md) 29 | * [引用一个库工程](referencing_a_library.md) 30 | * [库工程发布](library_publication.md) 31 | * [测试](testing.md) 32 | * [基本原理和配置](basics_and_configuration.md) 33 | * [运行测试](running_tests.md) 34 | * [测试Android库工程](testing_android_libraries.md) 35 | * [测试报告](test_reports.md) 36 | * [独立工程](single_projects.md) 37 | * [多工程报告](multi-projects_reports.md) 38 | * [Lint支持](lint_support.md) 39 | * [构建变种版本](build_variants.md) 40 | * [产物定制](product_flavors.md) 41 | * [构建类型+产物定制=构建变种版本](build_type_+_product_flavor_=_build_variant.md) 42 | * [产物定制配置](product_flavor_configuration.md) 43 | * [源组件和依赖](sourcesets_and_dependencies.md) 44 | * [构建和任务](building_and_tasks.md) 45 | * [测试](testing.md) 46 | * [多定制的变种版本](multi-flavor_variants.md) 47 | * [高级构建的自定义](advanced_build_customization.md) 48 | * [构建选项](build_options.md) 49 | * [Java编译选项](java_compilation_options.md) 50 | * [aapt选项](aapt_options.md) 51 | * [dex选项](dex_options.md) 52 | * [操作tasks](manipulating_tasks.md) 53 | * [构建类型和产物定制的属性引用](buildtype_and_product_flavor_property_reference.md) 54 | * [使用sourceCompatibility 1.7](using_sourcecompatibility_17.md) 55 | 56 | -------------------------------------------------------------------------------- /_book/GLOSSARY.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 |