{"id":703,"date":"2023-02-26T15:09:35","date_gmt":"2023-02-26T07:09:35","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=703"},"modified":"2023-04-29T17:19:12","modified_gmt":"2023-04-29T09:19:12","slug":"notes-on-instructions-such-as-android-gradle-compile-provided-api-implementation-etc","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/26\/notes-on-instructions-such-as-android-gradle-compile-provided-api-implementation-etc\/","title":{"rendered":"Android Gradle compile\u3001provided\u3001api\u3001implementation\u7b49\u6307\u4ee4\u6ce8\u610f\u70b9"},"content":{"rendered":"<p>Android Studio 3.0\u5f00\u59cb\u4f7f\u7528api\/implementation\u6307\u4ee4\uff0c\u5f03\u7528compile\/provided\uff0c\u603b\u7684\u6765\u8bf4\u662f\u4e3a\u4e86\u52a0\u5feb\u6784\u5efa\u7f16\u8bd1\u901f\u5ea6\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: center;\">Android Studio 2.X<\/th>\n<th style=\"text-align: center;\">Android Studio 3.X<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: center;\">apk<\/td>\n<td style=\"text-align: center;\">runtimeOnly<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">provided<\/td>\n<td style=\"text-align: center;\">compileOnly<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">compile<\/td>\n<td style=\"text-align: center;\">api<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u6ca1\u6709\u5bf9\u5e94<\/td>\n<td style=\"text-align: center;\">implementation<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">debugCompile<\/td>\n<td style=\"text-align: center;\">debugImplementation<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">releaseCompile<\/td>\n<td style=\"text-align: center;\">releaseImplementation<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">androidTestCompile<\/td>\n<td style=\"text-align: center;\">androidTestImplementation<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><!-- more --><\/p>\n<h3>implementation\u7cfb\u5217\u6307\u4ee4<\/h3>\n<p>\u6ce8\u610fcompile\u662f\u548capi\u5bf9\u5e94\u7684\uff0c\u6548\u679c\u76f8\u540c\u3002implementation\u7684\u533a\u522b\u5728\u4e8e\u5bf9\u5916\u53ef\u89c1\u6027\uff0c\u800c\u4e14\u53ef\u4ee5\u52a0\u5feb\u7f16\u8bd1\u901f\u5ea6\uff08\u539f\u7406\u5728\u4e8e\u51cf\u5c11\u4e0d\u5fc5\u8981\u7684\u91cd\u590d\u7f16\u8bd1\u8fc7\u7a0b\uff09\u3002\u4e3e\u4e2a\u4f8b\u5b50\u5982\u4e0b\uff1a<\/p>\n<pre><code>A module \u4f9d\u8d56 B module\uff0cB module \u4f9d\u8d56 C module\n\nAndroid Studio 2.X\u4f7f\u7528compile\uff1a\nA compile B\nB compile C\nA module\u4e0d\u4ec5\u53ef\u4ee5\u5f15\u7528B module\uff0c\u8fd8\u53ef\u4ee5\u5f15\u7528C module\u7684\u63a5\u53e3\u548c\u7c7b\u3002\n\nAndroid Studio 3.X\u4f7f\u7528implementation\uff1a\nA implementation B\nB implementation C\nA module\u53ea\u53ef\u4ee5\u5f15\u7528B module\uff0c\u4e0d\u53ef\u4ee5\u5f15\u7528C module\u3002C \u5bf9 A \u662f\u4e0d\u53ef\u89c1\u7684\uff01<\/code><\/pre>\n<p>\u7b80\u5355\u6765\u8bf4\uff0c\u4eceAndroid Studio 3.X\u5f00\u59cb\uff0c\u4f9d\u8d56\u9996\u5148\u5e94\u8be5\u8bbe\u7f6e\u4e3aimplementation\uff0c\u5982\u679c\u6ca1\u6709\u9519\u8bef\uff0c\u5c31\u7528implementation\uff0c\u5982\u679c\u6709\u9519\uff0c\u90a3\u4e48\u4f7f\u7528api\u6307\u4ee4\uff0c\u8fd9\u6837\u4f1a\u4f7f\u7f16\u8bd1\u901f\u5ea6\u6709\u6240\u589e\u5feb\u3002<\/p>\n<h3>provided\uff08compileOnly\uff09\u548ccompile\uff08api\uff09\u533a\u522b<\/h3>\n<p>\u6309\u7167\u51e0\u4e4e\u6240\u6709\u6587\u7ae0\u7684\u8bf4\u6cd5\uff1aprovided\u53ea\u63d0\u4f9b\u7f16\u8bd1\u652f\u6301\uff0c\u4f46\u662f\u4e0d\u4f1a\u5199\u5165apk\u3002\u4f7f\u7528provide\u53ef\u4ee5\u907f\u514d\u652f\u6301\u5305\u7248\u672c\u51b2\u7a81\u548c\u91cd\u590d\u6253\u5305\u5bfc\u81f4\u5b89\u88c5\u5305\u4f53\u79ef\u5f92\u589e\u3002<\/p>\n<p>\u4f46\u5c31\u5b9e\u8df5\u6765\u8bf4\uff08\u652f\u6301\u5305V7,V4\u4e4b\u7c7b\uff09\uff1a<\/p>\n<p>1\u3001\u4e0d\u4f7f\u7528provided\u4e5f\u4e0d\u4f1a\u5bfc\u81f4\u652f\u6301\u5305\u91cd\u590d\uff0c\u4f9d\u8d56module\u7f16\u8bd1\u51fa\u6765\u7684aar\u5e76\u4e0d\u5305\u542b\u90a3\u4e9b\u591a\u4e2amodule\uff08\u5305\u62ecapp module\uff09\u91cd\u590d\u4f7f\u7528\u7684\u652f\u6301\u5305\u3002<\/p>\n<p>2\u3001\u5982\u679c\u4f9d\u8d56module\u4f7f\u7528\u7684style\u4e2d\u5f15\u7528\u4e86\u652f\u6301\u5305\uff08V7,V4\u4e4b\u7c7b\u7684\uff09\u4e2d\u7684\u4e3b\u9898\uff0c\u90a3\u4e48\uff0c\u4f7f\u7528provided\u4f1a\u62a5\u9519\uff08\u627e\u4e0d\u5230\u4e3b\u9898\u8d44\u6e90\uff09\u3002\u5982\u679c\u53ea\u662f\u5f15\u7528\u652f\u6301\u5305\u4e2d\u7684\u7c7b\u548c\u63a5\u53e3\u662f\u53ef\u4ee5\u4f7f\u7528provided\u7684\uff08\u4f46\u610f\u4e49\u4e5f\u4e0d\u5927\uff0c\u53cd\u6b63\u4e5f\u4e0d\u4f1a\u91cd\u590d\uff09\u3002<\/p>\n<p>3\u3001\u53ef\u80fd\u76f4\u63a5\u5f15\u7528jar\u5305\u7684\u65b9\u5f0f\u4f1a\u91cd\u590d\u5427\uff0c\u4f46\u73b0\u5728\u8fd9\u79cd\u573a\u666f\u4e0d\u591a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Android Studio 3.0\u5f00\u59cb\u4f7f\u7528api\/implementation\u6307\u4ee4\uff0c\u5f03\u7528compile\/pr [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[202],"tags":[64],"class_list":["post-703","post","type-post","status-publish","format-standard","hentry","category-android-build","tag-gradle"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/703","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=703"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/703\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=703"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=703"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=703"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}