{"id":1588,"date":"2016-05-25T10:05:44","date_gmt":"2016-05-25T02:05:44","guid":{"rendered":"https:\/\/ai.zhousir.top\/?p=1588"},"modified":"2026-08-18T12:58:49","modified_gmt":"2026-08-18T04:58:49","slug":"%e5%8a%a0%e9%80%9fandroid-studiogradle%e6%9e%84%e5%bb%ba","status":"publish","type":"post","link":"https:\/\/ai.zhousir.top\/?p=1588","title":{"rendered":"\u52a0\u901fAndroid Studio\/Gradle\u6784\u5efa"},"content":{"rendered":"<section id=\"wenyan\" style=\"font-family: system-ui, 'Apple Color Emoji', 'Segoe UI', 'Segoe UI Symbol', 'Noto Sans', Roboto, sans-serif; line-height: 1.75; font-size: 16px; color: #000000; caret-color: #000000;\" data-provider=\"WenYan\">\n<blockquote style=\"margin: 20px 0px; display: block; font-size: 0.9em; overflow: auto; border-left: 3px solid #ef7060; color: #6a737d; padding: 10px 10px 10px 20px; background: #fff9f9;\">\n<p style=\"margin: 1em 0px;\">\u7528 Android Studio \u4e00\u5e74\u591a\uff0c\u9879\u76ee\u53d8\u5927\u3001\u4f9d\u8d56\u53d8\u591a\uff0c\u6784\u5efa\u8d8a\u6765\u8d8a\u6162\uff0crelease \u5305\u6700\u6162\u8981 6 \u5206\u949f\u3002\u7f51\u4e0a\u8fd9\u4e9b\u914d\u7f6e\u80fd\u660e\u663e\u52a0\u5feb\uff0c\u8fd9\u91cc\u6c47\u603b\u5206\u4eab\u3002<\/p>\n<\/blockquote>\n<p><!--more--><\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2020\/04\/201407311445259040063.jpg\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2826\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2020\/04\/201407311445259040063.jpg\" alt=\"20140731144525904006\" width=\"383\" height=\"268\" \/><\/a><\/p>\n<hr>\n<h2 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em; border-bottom: 2px solid #ef7060; display: flex;\"><span style=\"display: inline-block; font-weight: bold; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e00\u3001\u5f00\u542f Gradle \u5b88\u62a4\u8fdb\u7a0b<\/span><\/h2>\n<p style=\"margin: 1em 0px;\">\u5728\u7528\u6237\u76ee\u5f55\u521b\u5efa <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">gradle.properties<\/code>\uff1a<\/p>\n<ul style=\"padding-left: 1rem; margin-left: 1rem; font-size: 0.9rem; list-style-type: disc;\">\n<li>\n<section><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">\/home\/&lt;username&gt;\/.gradle\/<\/code> (Linux)<\/section>\n<\/li>\n<li>\n<section><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">\/Users\/&lt;username&gt;\/.gradle\/<\/code> (Mac)<\/section>\n<\/li>\n<li>\n<section><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">C:\\Users\\&lt;username&gt;\\.gradle<\/code> (Windows)<\/section>\n<\/li>\n<\/ul>\n<p style=\"margin: 1em 0px;\">\u5199\u5165\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 10px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 10px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; margin: 0.5em; padding: 3px 5px; overflow-x: auto; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">org.gradle.daemon=true<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u9879\u76ee\u4e0b\u7684 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">gradle.properties<\/code> \u4e5f\u53ef\u4ee5\u4e00\u8d77\u4f18\u5316\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 10px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 10px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; margin: 0.5em; padding: 3px 5px; overflow-x: auto; color: #93a1a1; background: #002b36; overflow-wrap: normal;\"># Project-wide Gradle settings.\n# IDE (e.g. Android Studio) users:\n# Settings specified in this file will override any Gradle settings\n# configured through the IDE.\n# For more details on how to configure your build environment visit\n# http:\/\/www.gradle.org\/docs\/current\/userguide\/build_environment.html\n# The Gradle daemon aims to improve the startup and execution time of Gradle.\n# When set to true the Gradle daemon is to run the build.\n# TODO: disable daemon on CI, since builds should be clean and reliable on servers\norg.gradle.daemon=true\n# Specifies the JVM arguments used for the daemon process.\n# The setting is particularly useful for tweaking memory settings.\n# Default value: -Xmx10248m -XX:MaxPermSize=256m\norg.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8\n# When configured, Gradle will run in incubating parallel mode.\n# This option should only be used with decoupled projects. More details, visit\n# http:\/\/www.gradle.org\/docs\/current\/userguide\/multi_project_builds.html#sec:decoupled_projects\norg.gradle.parallel=true\n# Enables new incubating mode that makes Gradle selective when configuring projects.\n# Only relevant projects are configured which results in faster builds for large multi-projects.\n# http:\/\/www.gradle.org\/docs\/current\/userguide\/multi_project_builds.html#sec:configuration_on_demand\norg.gradle.configureondemand=true<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u540c\u6837\u53c2\u6570\u4e5f\u53ef\u4ee5\u5199\u5230\u7528\u6237\u76ee\u5f55\u7684 gradle.properties\uff0c\u90a3\u6837\u5bf9\u6240\u6709\u9879\u76ee\u751f\u6548\uff0c\u4e0d\u9650\u4e8e\u5f53\u524d\u5de5\u7a0b\u3002\u6838\u5fc3\u5c31\u4e09\u4ef6\u4e8b\uff1a\u52a0\u5927 Gradle \u7684 JVM\u3001\u72ec\u7acb\u5b88\u62a4\u8fdb\u7a0b\u3001\u5141\u8bb8\u5e76\u884c\u3002\u73af\u5883\u8bf4\u660e\u89c1 <a href=\"http:\/\/www.gradle.org\/docs\/current\/userguide\/build_environment.html\">http:\/\/www.gradle.org\/docs\/current\/userguide\/build_environment.html<\/a>\uff1b\u5e76\u884c\u53ea\u9002\u5408\u89e3\u8026\u7684\u591a\u6a21\u5757\u5de5\u7a0b\uff0c\u89c1 <a href=\"http:\/\/www.gradle.org\/docs\/current\/userguide\/multi_project_builds.html\">http:\/\/www.gradle.org\/docs\/current\/userguide\/multi_project_builds.html<\/a>\u3002<\/p>\n<hr>\n<h2 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em; border-bottom: 2px solid #ef7060; display: flex;\"><span style=\"display: inline-block; font-weight: bold; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e8c\u3001\u4fee\u6539 Android Studio \u914d\u7f6e<\/span><\/h2>\n<p style=\"margin: 1em 0px;\">\u5728 IDE \u91cc\u5f00 Offline\uff0c\u5e76\u6539\u8fd0\u884c\u6a21\u5f0f\u548c VM\u3002\u5185\u5bb9\u548c\u4e0a\u9762\u90a3\u6bb5\u4e00\u6837\uff0c\u4f46\u53ea\u5bf9 IDE \u6784\u5efa\u751f\u6548\uff0c\u547d\u4ee4\u884c\u6784\u5efa\u4e0d\u4f1a\u5e26\u4e0a\u3002<\/p>\n<p style=\"margin: 1em 0px;\"><img decoding=\"async\" loading=\"lazy\" class=\"\" title=\"\u5f00\u542foffline\" src=\"http:\/\/www.jcodecraeer.com\/uploads\/20150324\/1427163726493316.png\" alt=\"\" width=\"894\" height=\"417\" \/><\/p>\n<p style=\"margin: 1em 0px;\"><img decoding=\"async\" loading=\"lazy\" class=\"\" title=\"\u8bbe\u7f6e\u8fd0\u884c\u6a21\u5f0f\u548cVM\u914d\u7f6e\" src=\"http:\/\/www.jcodecraeer.com\/uploads\/20150324\/1427163759336336.png\" alt=\"\" width=\"893\" height=\"463\" \/><\/p>\n<hr>\n<h2 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em; border-bottom: 2px solid #ef7060; display: flex;\"><span style=\"display: inline-block; font-weight: bold; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e09\u3001\u547d\u4ee4\u884c\u6784\u5efa<\/span><\/h2>\n<p style=\"margin: 1em 0px;\">\u57fa\u4e8e\u4e0a\u9762\u7684\u914d\u7f6e\uff0c\u547d\u4ee4\u540e\u9762\u52a0\u4e0a <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">--daemon --parallel --offline<\/code>\u3002<\/p>\n<hr>\n<h2 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em; border-bottom: 2px solid #ef7060; display: flex;\"><span style=\"display: inline-block; font-weight: bold; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u56db\u3001\u4f9d\u8d56\u5c3d\u91cf\u7528 aar<\/span><\/h2>\n<p style=\"margin: 1em 0px;\">\u7b2c\u4e09\u65b9\u5e93\u5c3d\u91cf\u7528 aar\uff0c\u53ef\u5728 maven <a href=\"http:\/\/gradleplease.appspot.com\/\" target=\"_blank\" rel=\"external\">http:\/\/gradleplease.appspot.com\/<\/a> \u6216 github <a href=\"https:\/\/github.com\/Goddchen\/mvn-repo\" target=\"_blank\" rel=\"external\">https:\/\/github.com\/Goddchen\/mvn-repo<\/a> \u641c\u3002\u81ea\u5df1\u7684\u5e93\u6a21\u5757\u4e5f\u53ef\u4ee5\u6253 aar\uff0c\u53c2\u8003 stormzhang\uff1a<a href=\"http:\/\/www.stormzhang.com\/android\/2015\/03\/01\/android-reference-local-aar\/\" target=\"_blank\" rel=\"external\">http:\/\/www.stormzhang.com\/android\/2015\/03\/01\/android-reference-local-aar\/<\/a>\u3002<\/p>\n<table style=\"border-collapse: collapse; margin: 1.4em auto; max-width: 100%; table-layout: fixed; text-align: left; overflow: auto; display: table; overflow-wrap: break-word; word-break: break-all;\" width=\"817\">\n<thead>\n<tr>\n<th style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top; font-weight: bold; background-color: #fff9f9; color: #ef7060;\">\u624b\u6bb5<\/th>\n<th style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top; font-weight: bold; background-color: #fff9f9; color: #ef7060;\">\u4f5c\u7528<\/th>\n<th style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top; font-weight: bold; background-color: #fff9f9; color: #ef7060;\">\u8303\u56f4<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">org.gradle.daemon=true<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u5c11\u542f\u52a8 JVM<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u7528\u6237\u76ee\u5f55\u6216\u9879\u76ee properties<\/td>\n<\/tr>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">jvmargs -Xmx2048m<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u52a0\u5927\u5806\uff0c\u5c11 GC<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u540c\u4e0a<\/td>\n<\/tr>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">parallel + configureondemand<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u5e76\u884c\u3001\u6309\u9700\u914d\u7f6e<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u89e3\u8026\u7684\u591a\u6a21\u5757\u9879\u76ee<\/td>\n<\/tr>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">IDE Offline<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u4e0d\u6bcf\u6b21\u62c9\u4f9d\u8d56<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u4ec5 Android Studio<\/td>\n<\/tr>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">&#8211;daemon &#8211;parallel &#8211;offline<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u547d\u4ee4\u884c\u540c\u6837\u52a0\u901f<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u547d\u4ee4\u884c<\/td>\n<\/tr>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">aar \u4ee3\u66ff\u6e90\u7801\u6a21\u5757<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u5c11\u7f16\u8bd1\u81ea\u5df1\u7684\u5e93<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u4f9d\u8d56\u58f0\u660e<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr>\n<h2 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em; border-bottom: 2px solid #ef7060; display: flex;\"><span style=\"display: inline-block; font-weight: bold; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e94\u3001\u540e\u8bb0<\/span><\/h2>\n<p style=\"margin: 1em 0px;\">\u539f\u6765 4\u30015 \u5206\u949f\u7684\u6784\u5efa\uff0c\u73b0\u5728\u5927\u7ea6 30 \u79d2\u3002\u82e5\u8fd8\u662f\u6162\uff0c\u8be5\u6362\u7535\u8111\u4e86\uff1aSSD\u3001\u66f4\u5927\u5185\u5b58\u662f\u5fc5\u987b\u7684\u3002\u539f\u6587\u5730\u5740\uff1a<a href=\"http:\/\/blog.isming.me\/2015\/03\/18\/android-build-speed-up\/\" target=\"_blank\" rel=\"external\">http:\/\/blog.isming.me\/2015\/03\/18\/android-build-speed-up\/<\/a><\/p>\n<blockquote style=\"margin: 20px 0px; display: block; font-size: 0.9em; overflow: auto; border-left: 3px solid #ef7060; color: #6a737d; padding: 10px 10px 10px 20px; background: #fff9f9;\">\n<p style=\"margin: 1em 0px;\"><strong>\u4e00\u53e5\u8bdd\u603b\u7ed3\uff1a\u52a0\u901f\u6784\u5efa\u5148\u5f00 daemon\u3001\u52a0\u5927 JVM\u3001\u5e76\u884c\u548c Offline\uff0c\u4f9d\u8d56\u6539 aar\uff1b\u8fd8\u6162\u5c31\u4e0a SSD \u548c\u5185\u5b58\u3002<\/strong><\/p>\n<\/blockquote>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>\u7528 Android Studio \u4e00\u5e74\u591a\uff0c\u9879\u76ee\u53d8\u5927\u3001\u4f9d\u8d56\u53d8\u591a\uff0c\u6784\u5efa\u8d8a\u6765\u8d8a\u6162\uff0crelease \u5305\u6700\u6162\u8981 6 \u5206\u949f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[194,12],"_links":{"self":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/1588"}],"collection":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1588"}],"version-history":[{"count":3,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/1588\/revisions"}],"predecessor-version":[{"id":2842,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/1588\/revisions\/2842"}],"wp:attachment":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1588"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1588"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1588"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}