{"id":2549,"date":"2018-03-01T15:25:21","date_gmt":"2018-03-01T07:25:21","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=2549"},"modified":"2018-03-01T15:25:21","modified_gmt":"2018-03-01T07:25:21","slug":"%e8%85%be%e8%ae%af-vasdolly-%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=2549","title":{"rendered":"\u817e\u8baf VasDolly \u6559\u7a0b"},"content":{"rendered":"<p>\n\t\u505a\u5f00\u53d1\u7684\u5fc5\u987b\u65f6\u523b\u5173\u6ce8\u65b0\u6280\u672f\u7684\u53d1\u5c55\uff01\u6700\u8fd1\u817e\u8baf\u5f00\u6e90\u4e86&nbsp;VasDolly \u3002\u5b83\u662f\u4e00\u6b3e Android V1\u548cV2\u7b7e\u540d\u901a\u9053\u5305\u63d2\u4ef6\uff0c\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5b83\u7684\u76f8\u5173\u7528\u6cd5\u3002\n<\/p>\n<p>\n\tVasDolly\u662f\u4e00\u79cd\u5feb\u901f\u591a\u6e20\u9053\u6253\u5305\u5de5\u5177\uff0c\u540c\u65f6\u652f\u6301\u57fa\u4e8eV1\u7b7e\u540d\u548cV2\u7b7e\u540d\u8fdb\u884c\u591a\u6e20\u9053\u6253\u5305\u3002\u63d2\u4ef6\u672c\u8eab\u4f1a\u81ea\u52a8\u68c0\u6d4bApk\u4f7f\u7528\u7684\u7b7e\u540d\u7c7b\u522b\uff0c\u5e76\u9009\u62e9\u5408\u9002\u7684\u591a\u6e20\u9053\u6253\u5305\u65b9\u5f0f\uff0c\u5bf9\u4f7f\u7528\u8005\u6765\u8bf4\u5b8c\u5168\u900f\u660e\u3002 V1.1.6\u7248\u672c\u5df2\u652f\u6301Android Gradle Plugin 3.0\u3002\n<\/p>\n<p>\n\tVasDolly \u7ec4\u4ef6\u7279\u6027\n<\/p>\n<ol>\n<li>\n\t\t\u652f\u6301V1\u7b7e\u540d\n\t<\/li>\n<li>\n\t\t\u652f\u6301V2\u7b7e\u540d\n\t<\/li>\n<li>\n\t\t\u652f\u6301\u5df2\u6709\u6ce8\u91ca\u5757\u7684APK\n\t<\/li>\n<li>\n\t\t\u652f\u6301\u6839\u636e\u5df2\u6709\u57fa\u7840\u5305\uff0c\u751f\u6210\u6e20\u9053\u5305\n\t<\/li>\n<li>\n\t\t\u652f\u6301\u591a\u7ebf\u7a0b\u52a0\u901f\u6253\u5305\n\t<\/li>\n<li>\n\t\t\u652f\u6301\u6e20\u9053\u5305\u5f3a\u6821\u9a8c\uff0c\u53ef\u4ee5\u653e\u5fc3\u4f7f\u7528\n\t<\/li>\n<li>\n\t\t\u652f\u6301\u4e24\u79cd\u63a5\u5165\u65b9\u5f0f\uff1aAndroid Gradle Plugin\u548c\u547d\u4ee4\u884c\n\t<\/li>\n<\/ol>\n<p>\n\t<img decoding=\"async\" alt=\"VasDolly\" src=\"http:\/\/img.bbs.csdn.net\/upload\/201710\/19\/1508401209_460143.png\" style=\"width: 1024px;height: 768px\" \/>\n<\/p>\n<p>\n\t\u76ee\u524dGradle Plugin 2.2\u4ee5\u4e0a\u9ed8\u8ba4\u5f00\u542fV2\u7b7e\u540d\uff0c\u6240\u4ee5\u5982\u679c\u60f3\u5173\u95edV2\u7b7e\u540d\uff0c\u53ef\u5c06\u4e0b\u9762\u7684v2SigningEnabled\u8bbe\u7f6e\u4e3afalse\u3002\n<\/p>\n<pre class=\"brush:java;\">\r\nsigningConfigs {\r\n\trelease {\r\n\t\t...\r\n\t\tv1SigningEnabled true\r\n\t\tv2SigningEnabled false\r\n\t}\r\n\/\/ \u4e1a\u4f59\u8349\uff1awww.xttblog.com\r\n\tdebug {\r\n\t\t...\r\n\t\tv1SigningEnabled true\r\n\t\tv2SigningEnabled false\r\n\t}\r\n}<\/pre>\n<h2>\n\t\u57fa\u672c\u7528\u6cd5<br \/>\n<\/h2>\n<p>\n\t\u6dfb\u52a0\u5bf9VasDolly Plugin\u7684\u4f9d\u8d56\u3002\u5728\u6839\u5de5\u7a0b\u7684build.gradle\u4e2d\uff0c\u6dfb\u52a0\u5bf9\u6253\u5305Plugin\u7684\u4f9d\u8d56\uff1a\n<\/p>\n<pre class=\"brush:java;\">\r\ndependencies {\r\n\tclasspath &#039;com.android.tools.build:gradle:3.0.0&#039;\r\n\tclasspath &#039;com.leon.channel:plugin:1.1.7&#039;\r\n}<\/pre>\n<p>\n\t\u5728\u4e3bApp\u5de5\u7a0b\u7684build.gradle\u4e2d\uff0c\u6dfb\u52a0\u5bf9VasDolly Plugin\u7684\u5f15\u7528\uff1a\n<\/p>\n<pre class=\"brush:java;\">\r\napply plugin: &#039;channel&#039;<\/pre>\n<p>\n\t\u5728\u4e3bApp\u5de5\u7a0b\u7684build.gradle\u4e2d\uff0c\u6dfb\u52a0\u8bfb\u53d6\u6e20\u9053\u4fe1\u606f\u7684helper\u7c7b\u5e93\u4f9d\u8d56\uff1a\n<\/p>\n<pre class=\"brush:plain;\">\r\ndependencies {\r\n    api &#039;com.leon.channel:helper:1.1.7&#039;\r\n}<\/pre>\n<p>\n\t\u76ee\u524d\u6709\u4e24\u79cd\u65b9\u5f0f\u914d\u7f6e\u6e20\u9053\u5217\u8868\uff0c\u6700\u7ec8\u7684\u6e20\u9053\u5217\u8868\u662f\u4e24\u8005\u7684\u7d2f\u52a0\u4e4b\u548c\uff1a\n<\/p>\n<p>\n\t1\u3001\u5728gradle.properties\u6587\u4ef6\u6307\u5b9a\u6e20\u9053\u6587\u4ef6\u540d\u79f0\uff0c\u8be5\u6e20\u9053\u6587\u4ef6\u5fc5\u987b\u4f4d\u4e8e\u6839\u5de5\u7a0b\u76ee\u5f55\u4e0b\uff0c\u4e00\u884c\u4e00\u4e2a\u6e20\u9053\u4fe1\u606f\u3002\n<\/p>\n<pre class=\"brush:plain;\">\r\nchannel_file=channel.txt<\/pre>\n<p>\n\t2\u3001\u5728channel\u6216\u8005rebuildChannel\u5c5e\u6027\u4e2d\u901a\u8fc7channelFile\u5c5e\u6027\u6307\u5b9a\u6e20\u9053\u6587\u4ef6\uff0c\u4e00\u884c\u4e00\u4e2a\u6e20\u9053\u4fe1\u606f\u3002\n<\/p>\n<pre class=\"brush:java;\">\r\nchannel{\r\n    \/\/\u6307\u5b9a\u6e20\u9053\u6587\u4ef6\r\n    channelFile = file(&quot;\/Users\/leon\/Downloads\/testChannel.txt&quot;)\r\n}\r\nrebuildChannel{\r\n    \/\/\u6307\u5b9a\u6e20\u9053\u6587\u4ef6\r\n    channelFile = file(&quot;\/Users\/leon\/Downloads\/testReChannel.txt&quot;)\r\n}<\/pre>\n<p>\n\t\u82e5\u662f\u76f4\u63a5\u7f16\u8bd1\u751f\u6210\u591a\u6e20\u9053\u5305\uff0c\u9996\u5148\u8981\u914d\u7f6e\u6e20\u9053\u6587\u4ef6\u3001\u6e20\u9053\u5305\u7684\u8f93\u51fa\u76ee\u5f55\u548c\u6e20\u9053\u5305\u7684\u547d\u540d\u89c4\u5219\uff1a\n<\/p>\n<pre class=\"brush:java;\">\r\nchannel{\r\n    \/\/\u6307\u5b9a\u6e20\u9053\u6587\u4ef6\r\n    channelFile = file(&quot;\/Users\/leon\/Downloads\/testChannel.txt&quot;)\r\n     \/\/\u591a\u6e20\u9053\u5305\u7684\u8f93\u51fa\u76ee\u5f55\uff0c\u9ed8\u8ba4\u4e3anew File(project.buildDir,&quot;channel&quot;)\r\n    baseOutputDir = new File(project.buildDir,&quot;xxx&quot;)\r\n    \/\/\u591a\u6e20\u9053\u5305\u7684\u547d\u540d\u89c4\u5219\uff0c\u9ed8\u8ba4\u4e3a\uff1a${appName}-${versionName}-${versionCode}-${flavorName}-${buildType}\r\n    apkNameFormat =&#039;${appName}-${versionName}-${versionCode}-${flavorName}-${buildType}&#039;\r\n    \/\/\u5feb\u901f\u6a21\u5f0f\uff1a\u751f\u6210\u6e20\u9053\u5305\u65f6\u4e0d\u8fdb\u884c\u6821\u9a8c\uff08\u901f\u5ea6\u53ef\u4ee5\u63d0\u534710\u500d\u4ee5\u4e0a\uff09\r\n    isFastMode = false\r\n}<\/pre>\n<p>\n\t\u5176\u4e2d\uff0c\u591a\u6e20\u9053\u5305\u7684\u547d\u540d\u89c4\u5219\u4e2d\uff0c\u53ef\u4f7f\u7528\u4ee5\u4e0b\u5b57\u6bb5\uff1a\n<\/p>\n<ul>\n<li>\n\t\tappName \uff1a \u5f53\u524dproject\u7684name\n\t<\/li>\n<li>\n\t\tversionName \uff1a \u5f53\u524dVariant\u7684versionName\n\t<\/li>\n<li>\n\t\tversionCode \uff1a \u5f53\u524dVariant\u7684versionCode\n\t<\/li>\n<li>\n\t\tbuildType \uff1a \u5f53\u524dVariant\u7684buildType\uff0c\u5373debug or release\n\t<\/li>\n<li>\n\t\tflavorName \uff1a \u5f53\u524d\u7684\u6e20\u9053\u540d\u79f0\n\t<\/li>\n<li>\n\t\tappId \uff1a \u5f53\u524dVariant\u7684applicationId\n\t<\/li>\n<\/ul>\n<p>\n\t\u7136\u540e\uff0c\u901a\u8fc7gradle channelDebug\u3001gradle channelRelease\u547d\u4ee4\u5206\u522b\u751f\u6210Debug\u548cRelease\u7684\u591a\u6e20\u9053\u5305\u3002\n<\/p>\n<p>\n\t\u82e5\u662f\u6839\u636e\u5df2\u6709\u57fa\u7840\u5305\u91cd\u65b0\u751f\u6210\u591a\u6e20\u9053\u5305\uff0c\u9996\u5148\u8981\u914d\u7f6e\u6e20\u9053\u6587\u4ef6\u3001\u57fa\u7840\u5305\u7684\u8def\u5f84\u548c\u6e20\u9053\u5305\u7684\u8f93\u51fa\u76ee\u5f55\uff1a\n<\/p>\n<pre class=\"brush:java;\">\r\nrebuildChannel {\r\n  \/\/\u6307\u5b9a\u6e20\u9053\u6587\u4ef6\r\n  channelFile = file(&quot;\/Users\/leon\/Downloads\/testReChannel.txt&quot;)\r\n  baseDebugApk = \u5df2\u6709Debug APK    \r\n  baseReleaseApk = \u5df2\u6709Release APK\r\n  \/\/\u9ed8\u8ba4\u4e3anew File(project.buildDir, &quot;rebuildChannel\/debug&quot;)\r\n  debugOutputDir = Debug\u6e20\u9053\u5305\u8f93\u51fa\u76ee\u5f55   \r\n  \/\/\u9ed8\u8ba4\u4e3anew File(project.buildDir, &quot;rebuildChannel\/release&quot;)\r\n  releaseOutputDir = Release\u6e20\u9053\u5305\u8f93\u51fa\u76ee\u5f55\r\n  \/\/\u5feb\u901f\u6a21\u5f0f\uff1a\u751f\u6210\u6e20\u9053\u5305\u65f6\u4e0d\u8fdb\u884c\u6821\u9a8c\uff08\u901f\u5ea6\u53ef\u4ee5\u63d0\u534710\u500d\u4ee5\u4e0a\uff09\r\n  isFastMode = false\r\n}<\/pre>\n<p>\n\t\u7136\u540e\uff0c\u901a\u8fc7gradle rebuildChannel\u547d\u4ee4\u751f\u6210\u591a\u6e20\u9053\u5305\u3002\n<\/p>\n<p>\n\t\u901a\u8fc7helper\u7c7b\u5e93\u4e2d\u7684ChannelReaderUtil\u7c7b\u8bfb\u53d6\u6e20\u9053\u4fe1\u606f\u3002\n<\/p>\n<pre class=\"brush:java;\">\r\nString channel = ChannelReaderUtil.getChannel(getApplicationContext());<\/pre>\n<p>\n\t\u5982\u679c\u6ca1\u6709\u6e20\u9053\u4fe1\u606f\uff0c\u90a3\u4e48\u8fd9\u91cc\u8fd4\u56denull\uff0c\u5f00\u53d1\u8005\u9700\u8981\u81ea\u5df1\u5224\u65ad\u3002<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=2549\">\u817e\u8baf VasDolly \u6559\u7a0b<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u505a\u5f00\u53d1\u7684\u5fc5\u987b\u65f6\u523b\u5173\u6ce8\u65b0\u6280\u672f\u7684\u53d1\u5c55\uff01\u6700\u8fd1\u817e\u8baf\u5f00\u6e90\u4e86&nbsp;VasDolly \u3002\u5b83\u662f\u4e00\u6b3e Android V1 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[891,697,699,69,865],"class_list":["post-2549","post","type-post","status-publish","format-standard","hentry","category-java","tag-android","tag-android-studio","tag-androiddevtools","tag-java","tag-865"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2549","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2549"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2549\/revisions"}],"predecessor-version":[{"id":2550,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2549\/revisions\/2550"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2549"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2549"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2549"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}