{"id":245,"date":"2025-04-09T09:09:13","date_gmt":"2025-04-09T01:09:13","guid":{"rendered":"http:\/\/www.devblog.cn\/?p=245"},"modified":"2025-04-09T15:11:35","modified_gmt":"2025-04-09T07:11:35","slug":"android%e6%9e%b6%e6%9e%84%e8%ae%be%e8%ae%a1%ef%bc%88%e6%a8%a1%e5%9d%97%e5%8c%96%e7%bb%84%e4%bb%b6%e5%8c%96mvi%ef%bc%89","status":"publish","type":"post","link":"http:\/\/www.devblog.cn\/?p=245","title":{"rendered":"Android\u67b6\u6784\u8bbe\u8ba1\uff08\u6a21\u5757\u5316+\u7ec4\u4ef6\u5316+MVI\uff09"},"content":{"rendered":"<style>\n    table {\n      width: 100%;\n      table-layout: fixed;\n      border-collapse: collapse;\n    }\n<\/style>\n<h1>Architecture-Android<\/h1>\n<h1>\u529f\u80fd\u4ecb\u7ecd<\/h1>\n<ul>\n<li>\u652f\u6301<strong>\u914d\u7f6e\u53d8\u66f4<\/strong>\u540e\u7684\u8fd8\u539f\n<ul>\n<li><strong>\u5c4f\u5e55\u65cb\u8f6c<\/strong><\/li>\n<li><strong>\u4eae\u6697\u4e3b\u9898<\/strong>\u5207\u6362<\/li>\n<li><strong>\u8bed\u8a00<\/strong>\u5207\u6362\uff08\u56fd\u9645\u5316\uff09<\/li>\n<li><strong>\u5b57\u4f53\u5927\u5c0f<\/strong>\u66f4\u6539<\/li>\n<li><strong>\u5206\u5c4f<\/strong><\/li>\n<li><strong>&#8230;<\/strong><\/li>\n<\/ul>\n<\/li>\n<li>\u652f\u6301<strong>\u8fdb\u7a0b\u6740\u6b7b<\/strong>\u540e\u7684\u8fd8\u539f<\/li>\n<li>\u9879\u76ee\u67b6\u6784\uff1a<strong>\u6a21\u5757\u5316+\u7ec4\u4ef6\u5316+MVI<\/strong>\uff08UiState+ViewModel+Flow+Kotlin\u534f\u7a0b+Repository+DataSource+Retrofit\uff09<\/li>\n<li>\u652f\u6301<strong>\u591aApp\u5f00\u53d1<\/strong><\/li>\n<li>\u652f\u6301\u4e00\u952e<strong>\u5207\u6362Feature\u6a21\u5757\u5355\u72ec\u8fd0\u884c<\/strong><\/li>\n<li>\u652f\u6301\u4e00\u952e<strong>\u53bb\u9664\u53ef\u79fb\u9664\u529f\u80fd\u4ee3\u7801<\/strong><\/li>\n<li>\u652f\u6301\u9879\u76ee<strong>\u65e0\u53cd\u5c04<\/strong>\u5b9e\u73b0\uff08\u9879\u76ee\u9ed8\u8ba4\u65e0\u53cd\u5c04\u5b9e\u73b0\uff0c\u53cd\u5c04\u5b9e\u73b0\u4e5f\u63d0\u4f9b\uff0c\u53ef\u4f9b\u5728\u4e24\u8005\u9009\u62e9\uff09<\/li>\n<li>\u652f\u6301<strong>EdgeToEdge<\/strong>\uff08<code>targetSdk &gt;= 35<\/code>(Android15)\uff0c<strong>\u5f3a\u5236<\/strong>\u5f00\u542f\u4e86\uff0c\u6240\u4ee5\u4e3a\u4e86\u5f00\u542f\u65f6\u517c\u4efb\u4f4e\u7248\u672c\uff0c\u9700\u8981\u5168\u90e8\u652f\u6301\uff09<\/li>\n<li>\u652f\u6301<strong>\u52a8\u6001\u4e3b\u9898<\/strong>\uff08<code>Android12+<\/code>\u652f\u6301\u6b64\u529f\u80fd\uff09<\/li>\n<li>\u652f\u6301<strong>\u5237\u65b0\u3001\u81ea\u52a8\u9884\u52a0\u8f7d<\/strong>\uff08\u81ea\u52a8\u9884\u52a0\u8f7d\uff0c\u5982\u679c\u7528\u6237\u6ed1\u52a8\u6162\u5e76\u4e14\u83b7\u53d6\u6570\u636e\u5feb\uff0c\u7528\u6237\u662f\u611f\u89c9\u4e0d\u5230\u52a0\u8f7d\u7684\uff09<\/li>\n<\/ul>\n<p>\u672c\u9879\u76ee\u4e3a\u4e00\u4e2a<strong>Android\u67b6\u6784<\/strong>\uff0c\u5b83\u9075\u5faa <strong>Android \u8bbe\u8ba1<\/strong>\u548c<strong>\u5f00\u53d1\u6700\u4f73\u5b9e\u8df5<\/strong>\uff0c\u65e8\u5728\u4e3a\u5f00\u53d1\u8005<strong>\u63d0\u4f9b\u5b9e\u7528\u53c2\u8003<\/strong>\u3002<\/p>\n<p>\u672c\u9879\u76ee<strong>\u76ee\u6807<\/strong>\u662f\u4e3a\u4e86<strong>\u540c\u65f6<\/strong>\u652f\u6301<code>Compose<\/code>\u548c<code>View<\/code>\uff0c\u4ee5\u652f\u6301<strong>\u516c\u53f8\u9879\u76ee<\/strong>\u76ee\u524d\u5df2\u6709\u7684<code>View<\/code>\u4ee3\u7801\u548c\u4e4b\u540e\u7684<code>Compose<\/code>\u4ee3\u7801\uff0c\u76ee\u524d\u672c\u9879\u76ee<strong>\u4ec5<\/strong>\u652f\u6301<code>View<\/code>\uff0c\u540e\u7eed\u9879\u76ee<strong>\u5173\u6ce8\u5ea6<\/strong> <strong>\uff08Star\u70b9\u8d5e\u6570\uff09<\/strong> <strong>\u9ad8\u540e<\/strong>\u4f1a\u652f\u6301<code>Compose<\/code>\u3002<\/p>\n<p>\u672c\u9879\u76ee\u662f\u4ee5<strong>\u5b57\u8282\u8df3\u52a8<\/strong>\u516c\u53f8\u7684<strong>\u6296\u97f3<\/strong>App\u4e3a\u53c2\u7167\uff0c\u6a21\u62df\u5f00\u53d1\u7684<strong>\u6296\u97f3<\/strong>App\u3002\u7531\u4e8e\u672c\u9879\u76ee\uff0c<strong>\u65e0\u6296\u97f3\u771f\u6b63\u7684\u7f51\u7edc\u6570\u636e<\/strong>\uff0c\u6240\u4ee5\u672c\u9879\u76ee\u4f7f\u7528\u7684\u6570\u636e\uff0c\u662f\u901a\u8fc7\u67d0\u4e9b<strong>\u5f00\u6e90API<\/strong>\u7f51\u7edc\u63a5\u53e3\uff0c<strong>\u6a21\u62df<\/strong>\u8f6c\u7684<strong>\u7f51\u7edc\u6570\u636e<\/strong>\u3002<\/p>\n<p>\u672c\u9879\u76ee\u662f\u5728<strong>\u5b98\u65b9\u7684\u67b6\u6784<\/strong>\uff08<a href=\"https:\/\/github.com\/android\/nowinandroid\">nowinandroid\uff0818.2k Star\uff09<\/a>\u3001<a href=\"https:\/\/github.com\/android\/architecture-samples\">architecture-samples\uff0844.9k Star\uff09<\/a>\uff09\u4e0a\u505a\u7684<strong>\u5347\u7ea7\u548c\u4fee\u6539<\/strong>\uff0c\u5982\u679c\u5927\u5bb6\u5bf9<strong>\u6b64\u67b6\u6784\u6a21\u5757\u7684\u5212\u5206<\/strong>\u4e0d\u7406\u89e3\uff0c\u5efa\u8bae\u5927\u5bb6\u5148\u4e86\u89e3<strong>\u5b98\u65b9\u7684<\/strong><a href=\"https:\/\/github.com\/android\/nowinandroid\">nowinandroid<\/a>\uff0c\u7136\u540e\u518d\u6765\u770b\u672c\u9879\u76ee\u3002<\/p>\n<p>\u672c\u9879\u76ee\u6587\u6863\u5206\u4e3a<strong>\u5feb\u901f\u4ecb\u7ecd<\/strong>\u3001<strong>\u8be6\u7ec6\u4ecb\u7ecd<\/strong>\uff08<strong>\u6a21\u5757\u95f4\u67b6\u6784<\/strong>\u3001<strong>\u6a21\u5757\u5185\u67b6\u6784<\/strong>\uff09\u3001<strong>\u4f7f\u7528<\/strong>\uff0c\u5efa\u8bae\u5927\u5bb6\u6309\u7167\u987a\u5e8f\u9605\u8bfb\u6587\u6863\u3002\u5982\u679c\u4f60<strong>\u60f3\u5feb\u901f<\/strong>\u7684\u4e86\u89e3\uff0c\u53ef\u4ee5\u53ea\u770b<strong>\u5feb\u901f\u4ecb\u7ecd<\/strong>\u3001<strong>\u4f7f\u7528<\/strong>\uff0c\u6211\u63d0\u4f9b\u4e86<strong>demo\u5de5\u7a0b<\/strong>\uff0c\u91cc\u9762\u6709<strong>\u6700\u7b80\u5355<\/strong>\u7684<strong>\u4f7f\u7528\u6848\u4f8b<\/strong>\uff0c\u53ef\u4ee5\u5148\u9605\u8bfb\u6b64\u4ee3\u7801\u3002<\/p>\n<p>\u6b22\u8fce\u5927\u5bb6\u4e00\u8d77\u6765<strong>\u7ef4\u62a4<\/strong>\u9879\u76ee\uff0c\u4f7f\u5176\u529f\u80fd\u66f4\u52a0\u7684<strong>\u5f3a\u5927<\/strong>\u3001<strong>\u5065\u7855<\/strong>\u3002\u6709\u95ee\u9898\uff0c\u6709\u9700\u6c42\uff0c\u8bf7\u63d0<a href=\"https:\/\/github.com\/zrq1060\/architecture-android\/issues\/new\">issue<\/a>\uff0c\u6216\u8005\u79c1\u4fe1\u6211\u3002<\/p>\n<p><strong>\u9879\u76ee\u94fe\u63a5\uff1a<\/strong> <a href=\"https:\/\/github.com\/zrq1060\/architecture-android\">architecture-android<\/a>\uff0c<strong>\u6b22\u8fce\u5927\u5bb6\u70b9\u8d5e\u3001\u6536\u85cf\uff0c\u4ee5\u65b9\u4fbf\u60a8\u540e\u7eed\u67e5\u770b\u3002<\/strong><\/p>\n<h2>\u4e0b\u8f7d<\/h2>\n<p><a href=\"https:\/\/github.com\/zrq1060\/architecture-android\/blob\/master\/docs\/images\/apk\/app-release.apk\">Apk\u4e0b\u8f7d<\/a><\/p>\n<p><strong>\u626b\u7801\u4e0b\u8f7d<\/strong><\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/aefcfc71555b42f49716b1854981dabf~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=e210mXdaIzSFl7EqhmZ8QPK4Phw%3D'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/aefcfc71555b42f49716b1854981dabf~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=e210mXdaIzSFl7EqhmZ8QPK4Phw%3D\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"qrcode.png\" \/><\/div><\/p>\n<h2>\u622a\u56fe<\/h2>\n<h3>App\u5c55\u793a<\/h3>\n<table>\n<thead>\n<tr>\n<th><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/81b4cba3f01c4d67b2eeeb1ec9e0299c~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=GwGWA0rItvTWuQUvSqVOGt2T2BE%3D'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/81b4cba3f01c4d67b2eeeb1ec9e0299c~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=GwGWA0rItvTWuQUvSqVOGt2T2BE%3D\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"screenshot1.png\" \/><\/div><\/th>\n<th><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/63d4388df3d74422811c03547cbe4fd4~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=yLULYBouy27AfmGrcw1Yls9TcI8%3D'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/63d4388df3d74422811c03547cbe4fd4~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=yLULYBouy27AfmGrcw1Yls9TcI8%3D\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"screenshot2.png\" \/><\/div><\/th>\n<th><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/2465869a884d4999a1b96dcca48f3689~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=mT5tKqLj0nRa%2FDZTIJbGAkK6N8w%3D'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/2465869a884d4999a1b96dcca48f3689~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=mT5tKqLj0nRa%2FDZTIJbGAkK6N8w%3D\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"screenshot3.png\" \/><\/div><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u4e3b\u9898\u5c55\u793a<\/h3>\n<table>\n<thead>\n<tr>\n<th align=\"center\">Themes<\/th>\n<th align=\"center\">Light<\/th>\n<th align=\"center\">Dark<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td align=\"center\"><strong>\u6296\u97f3\u4e3b\u9898<\/strong><\/td>\n<td align=\"center\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/d4556175c6974c96a381576e855b65e5~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=WSxIer6b0ual6Js2Bv2b1pXz%2BgU%3D'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/d4556175c6974c96a381576e855b65e5~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=WSxIer6b0ual6Js2Bv2b1pXz%2BgU%3D\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"theme&#95;douyin&#95;light.png\" \/><\/div><\/td>\n<td align=\"center\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/877a4c315721456a909b661038dc3138~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=a7wUAdA46S7FFBOlQYj0J4LX0Ps%3D'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/877a4c315721456a909b661038dc3138~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=a7wUAdA46S7FFBOlQYj0J4LX0Ps%3D\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"theme&#95;douyin&#95;dark.png\" \/><\/div><\/td>\n<\/tr>\n<tr>\n<td align=\"center\"><strong>\u52a8\u6001\u4e3b\u98981<\/strong><\/td>\n<td align=\"center\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/4cbaeb89d1f04ad2b1a6793752949454~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=0yn6NbHrNf38U0wPvCJjap0RKqo%3D'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/4cbaeb89d1f04ad2b1a6793752949454~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=0yn6NbHrNf38U0wPvCJjap0RKqo%3D\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"theme&#95;dynamic1&#95;light.png\" \/><\/div><\/td>\n<td align=\"center\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/bdc8ac8c4d124c8aa34c6a3560c078dd~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=VJ56GnjiRoYKABRBNMOQlOxRUoU%3D'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/bdc8ac8c4d124c8aa34c6a3560c078dd~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=VJ56GnjiRoYKABRBNMOQlOxRUoU%3D\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"theme&#95;dynamic1&#95;dark.png\" \/><\/div><\/td>\n<\/tr>\n<tr>\n<td align=\"center\"><strong>\u52a8\u6001\u4e3b\u98982<\/strong><\/td>\n<td align=\"center\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/7b73dd4e9fe249d9bdff29b527ef6190~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=04mwxc4FpxpjvZVoOA7KHxSixcA%3D'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/7b73dd4e9fe249d9bdff29b527ef6190~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=04mwxc4FpxpjvZVoOA7KHxSixcA%3D\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"theme&#95;dynamic2&#95;light.png\" \/><\/div><\/td>\n<td align=\"center\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/757dca39442049968d66b72df9bd56a4~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=%2BvMiQp2pFdVaD5466A9TC8UKhfw%3D'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/757dca39442049968d66b72df9bd56a4~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=%2BvMiQp2pFdVaD5466A9TC8UKhfw%3D\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"theme&#95;dynamic2&#95;dark.png\" \/><\/div><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h1>\u5feb\u901f\u4ecb\u7ecd<\/h1>\n<h2>\u4e0b\u8f7d<\/h2>\n<p><strong>\u4e0b\u8f7d\u9879\u76ee\u5e76\u8fd0\u884c<\/strong><\/p>\n<pre><code class=\"language-shell\">git clone git@github.com:zrq1060\/architecture-android.git\n<\/code><\/pre>\n<h2>\u529f\u80fd\u6f14\u793a<\/h2>\n<blockquote><p>\n  \u672c\u9879\u76ee<strong>\u4efb\u4f55<\/strong>\u9875\u9762\uff0c\u90fd\u652f\u6301\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li><strong>\u914d\u7f6e\u53d8\u66f4\u540e\u7684\u8fd8\u539f<\/strong>\uff08<strong>\u5c4f\u5e55\u65cb\u8f6c<\/strong>\u3001<strong>\u4eae\u6697\u6a21\u5f0f\u5207\u6362<\/strong>\u3001<strong>\u8bed\u8a00\u5207\u6362<\/strong>\u3001<strong>\u5b57\u4f53\u5927\u5c0f\u66f4\u6539<\/strong>\u3001<strong>\u5206\u5c4f<\/strong>\u7b49\uff09\uff0c\u914d\u7f6e\u53d8\u66f4\u4f1a\u5bfc\u81f4<code>Activity<\/code>\u3001<code>Fragment<\/code>\u4f1a<strong>\u91cd\u65b0\u521b\u5efa\u65b0\u7684<\/strong>\u3002<\/li>\n<li><strong>\u8fdb\u7a0b\u88ab\u6740\u6b7b\u540e\u7684\u8fd8\u539f<\/strong>\uff08\u53ef\u6253\u5f00\uff0c\u5f00\u53d1\u8005\u9009\u9879-\u540e\u53f0\u8fdb\u7a0b\u9650\u5236-\u4e0d\u5141\u8bb8\u540e\u53f0\u8fdb\u7a0b\uff0c\u4ee5\u66f4\u597d\u7684\u6d4b\u8bd5\u8fdb\u7a0b\u88ab\u6740\u6b7b\u3002\u5f00\u542f\u540e\uff0c\u53ef\u5728\u540e\u53f0\u591a\u6253\u5f00\u4e00\u4e9b\u65e0\u5173\u7684app\uff0c\u518d\u5207\u6362\u6253\u5f00\u6b64app\u5373\u53ef\u6f14\u793a\u6b64\u6548\u679c\uff09\u3002<\/li>\n<\/ul>\n<\/blockquote>\n<p>\u672c\u9879\u76ee\uff0c\u76ee\u524d<strong>\u4ec5\u652f\u6301<\/strong>\u5982\u4e0b\u529f\u80fd\uff1a<\/p>\n<ul>\n<li><strong>\u767b\u5f55\u9875<\/strong>\uff1a\u767b\u5f55\u8d26\u53f7\uff08\u624b\u673a\u53f7\u3001\u90ae\u7bb1\uff09\u4e3a <strong>\u3010\u4efb\u610f\u3011<\/strong>\uff0c\u767b\u5f55\u5bc6\u7801\uff08\u9a8c\u8bc1\u7801\u3001\u5bc6\u7801\uff09\u4e3a <strong>\u3010123456\u3011<\/strong>\u3002<strong>\u53ef\u65ad\u7f51<\/strong>\uff0c\u6216\u8f93\u5165<strong>\u9519\u8bef\u5bc6\u7801<\/strong>\uff0c\u67e5\u770b\u9875\u9762\u6548\u679c\u3002<\/p>\n<\/li>\n<li><strong>Home\u9996\u9875<\/strong>\uff1a\u9876\u90e8\u680f\u76ee\u7684\u6392\u5e8f\uff08<strong>\u957f\u6309\u9996\u9875-\u9876\u90e8\u680f\u76ee<\/strong>\uff09<\/p>\n<\/li>\n<li><strong>Main\u4e3b\u9875<\/strong>\uff1a\u597d\u53cb\u3001\u5546\u573a\u680f\u76ee\u7684\u5207\u6362\uff08<strong>\u957f\u6309\u4e3b\u9875-\u5e95\u90e8\u680f\u76ee\u7b2c2\u4e2a<\/strong>\uff09<\/p>\n<\/li>\n<li><strong>Shop\u5546\u57ce\u9875<\/strong>\uff1a\u652f\u6301<strong>\u5237\u65b0<\/strong>\u3001<strong>\u81ea\u52a8\u52a0\u8f7d<\/strong>\uff0c<strong>\u70b9\u51fb\u5546\u57ce\u6761\u76ee<\/strong>\u6a21\u62df\u7684\u5546\u57ce\u5217\u8868\u6570\u636e\u7684<strong>\u589e\u3001\u5220\u3001\u6539<\/strong>\u64cd\u4f5c\u3002<strong>\u53ef\u65ad\u7f51<\/strong>\uff0c\u67e5\u770b\u9875\u9762\u6548\u679c\u3002<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u5728\u6b64\u8ddf\u7740\u4e0a\u9762\uff0c\u64cd\u4f5cApp\u652f\u6301\u7684\u529f\u80fd\uff08\u8bb0\u5f97\u5f00\u542f\u5c4f\u5e55\u81ea\u52a8\u65cb\u8f6c\u3001\u5207\u6362\u4eae\u6697\u6a21\u5f0f\u3001\u70b9\u51fb\u5546\u57ceItem\uff09\uff0c\u4ee5\u6f14\u793a\u4e0a\u9762\u529f\u80fd\u6548\u679c\u3002<\/strong><\/p>\n<h2>\u5355\u72ec\u8fd0\u884cFeature\u6a21\u5757\u6f14\u793a<\/h2>\n<p>1\u3001\u4fee\u6539<strong>\u9879\u76ee\u6839\u76ee\u5f55<\/strong>\u4e0b<code>gradle.properties<\/code>\u5185<code>isFeatureSingle<\/code>\u4e3a<code>true<\/code>\uff0c\u5e76<code>Sync<\/code>\u540c\u6b65<code>Gradle<\/code>\u3002<\/p>\n<pre><code class=\"language-groovy\">isFeatureSingle = true\n<\/code><\/pre>\n<p>2\u3001\u6267\u884c<strong>\u5b89\u88c5\u5168\u90e8\u547d\u4ee4<\/strong><\/p>\n<p>\u70b9\u51fb\u53f3\u4fa7<code>Gradle<\/code>&#8211;<code>Tasks<\/code>&#8211;<code>install<\/code>&#8211;<code>installDebug<\/code>\uff0c<strong>\u6216<\/strong>\u6267\u884c\u5982\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code class=\"language-groovy\">.\\gradlew installDebug\n<\/code><\/pre>\n<p>\u6267\u884c\u5b8c\u540e\uff0c\u4f1a\u5728<strong>\u624b\u673a\u684c\u9762<\/strong>\u51fa\u73b0<strong>\u6240\u6709Feature\u6a21\u5757<\/strong>\u7684<code>App<\/code>\uff08\u5982\u4e0b\u56fe\u6240\u793a\uff09\uff0c<strong>\u70b9\u51fb<\/strong>\u67d0\u4e2a\u5373\u53ef\u6d4b\u8bd5\u67d0\u5355\u4e2a<strong>Feature<\/strong>\u6a21\u5757\u3002<\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/0750001928344f16b1e99acef3a2ac1c~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=6HV4wJaNoneImPj1w9SAh6i3Q2I%3D'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/0750001928344f16b1e99acef3a2ac1c~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=6HV4wJaNoneImPj1w9SAh6i3Q2I%3D\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"feature&#95;single&#95;apps.png\" \/><\/div><\/p>\n<h1>\u8be6\u7ec6\u4ecb\u7ecd<\/h1>\n<p>\u6211\u4eec\u5148\u8bb2<strong>\u6a21\u5757\u95f4\u7684\u67b6\u6784<\/strong>\uff0c\u7136\u540e\u518d\u8bb2<strong>\u6a21\u5757\u5185\u7684\u67b6\u6784<\/strong>\uff0c\u6700\u540e\u8bb2<strong>\u4f7f\u7528<\/strong>\u3002<\/p>\n<h2>\u6a21\u5757\u95f4\u67b6\u6784<\/h2>\n<p>\u5728\u4e0d\u65ad\u53d8\u5927\u7684\u4ee3\u7801\u5e93\u4e2d\uff0c<strong>\u53ef\u6269\u7f29\u6027<\/strong>\u3001<strong>\u53ef\u8bfb\u6027<\/strong>\u548c<strong>\u6574\u4f53\u4ee3\u7801\u8d28\u91cf<\/strong>\u901a\u5e38\u4f1a\u968f\u7740\u65f6\u95f4\u7684\u63a8\u79fb\u800c\u964d\u4f4e\u3002\u8fd9\u662f\u56e0\u4e3a\u4ee3\u7801\u5e93\u5728\u4e0d\u65ad\u53d8\u5927\uff0c\u800c\u5176\u7ef4\u62a4\u8005\u672a\u91c7\u53d6\u79ef\u6781\u63aa\u65bd\u6765\u4fdd\u6301\u6613\u4e8e\u7ef4\u62a4\u7684\u7ed3\u6784\u3002<strong>\u6a21\u5757\u5316<\/strong>\u662f\u4e00\u79cd\u884c\u4e4b\u6709\u6548\u7684\u4ee3\u7801\u5e93\u6784\u5efa\u65b9\u6cd5\uff0c\u53ef\u5e2e\u52a9\u6539\u5584\u53ef\u7ef4\u62a4\u6027\u5e76\u907f\u514d\u6b64\u7c7b\u95ee\u9898\u3002<\/p>\n<blockquote>\n<ul>\n<li><strong>\u6a21\u5757\u5316<\/strong>\u76f8\u5173\uff0c\u8bf7\u770b\u5b98\u65b9\u7684 <a href=\"https:\/\/developer.android.com\/topic\/modularization\">Android \u5e94\u7528\u6a21\u5757\u5316\u6307\u5357<\/a>\u3002\n<\/li>\n<li>\n<p><strong>\u5b98\u65b9\uff08\u6807\u51c6\u7248\uff09\u6a21\u5757\u5212\u5206demo<\/strong>\u76f8\u5173\uff0c\u8bf7\u770b\u5b98\u65b9\u7684<a href=\"https:\/\/github.com\/android\/nowinandroid\">nowinandroid<\/a>\u3002<\/p>\n<\/li>\n<\/ul>\n<\/blockquote>\n<h3>\u6a21\u5757\u5212\u5206<\/h3>\n<h4>\u6807\u51c6\u7248<\/h4>\n<p>\u672c\u9879\u76ee<strong>\u5b98\u65b9\uff08\u6807\u51c6\u7248\uff09<\/strong>\u7684<strong>\u6a21\u5757\u5316<\/strong>\u5b8c\u6210\u540e\uff0c<strong>\u6a21\u5757\u56fe\uff08\u90e8\u5206\u6a21\u5757\uff09<\/strong> \u5982\u4e0b\uff1a<\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/d5abfec98ff64d5ab93bc466341dc8f3~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=pyXa1Eo%2BXrZ20O3nQ5ngU7Y6%2BdQ%3D'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/d5abfec98ff64d5ab93bc466341dc8f3~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=pyXa1Eo%2BXrZ20O3nQ5ngU7Y6%2BdQ%3D\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"modularization&#95;graph&#95;standard.png\" \/><\/div><\/p>\n<p><strong>\u6a21\u5757\u8bf4\u660e\uff1a<\/strong><\/p>\n<ul>\n<li><code>app<\/code><strong>\u6a21\u5757<\/strong>\uff1a<code>app<\/code>\u6a21\u5757\u4f9d\u8d56\u4e8e<strong>\u6240\u6709<\/strong>\u7684<code>feature<\/code>\u6a21\u5757\u548c<strong>\u5fc5\u9700<\/strong>\u7684<code>core<\/code>\u6a21\u5757\u3002<\/li>\n<li><code>feature:<\/code><strong>\u6a21\u5757<\/strong>\uff1a<code>feature<\/code>\u6a21\u5757<strong>\u4e0d\u5e94\u8be5\u4f9d\u8d56\u4e8e\u5176\u5b83\u7684<\/strong><code>feature<\/code>\u6a21\u5757\uff0c\u5b83\u4eec\u53ea\u4f9d\u8d56\u4e8e<strong>\u6240\u9700<\/strong>\u7684<code>core<\/code>\u6a21\u5757\u3002<\/li>\n<li><code>core:<\/code><strong>\u6a21\u5757<\/strong>\uff1a<code>core<\/code>\u6a21\u5757<strong>\u53ef\u4ee5\u4f9d\u8d56\u4e8e\u5176\u5b83\u7684<\/strong><code>core<\/code>\u6a21\u5757\uff0c\u4f46<strong>\u5b83\u4eec\u4e0d\u5e94\u8be5\u4f9d\u8d56\u4e8e<\/strong><code>feature<\/code>\u6a21\u5757\u6216<code>app<\/code>\u6a21\u5757\u3002<\/li>\n<\/ul>\n<p>\u672c\u9879\u76ee<strong>\u5b98\u65b9<\/strong>\u7684<strong>\u6a21\u5757\u5316<\/strong>\u5b8c\u6210\u540e\uff0c\u9879\u76ee<strong>\u76ee\u5f55\u56fe<\/strong>\u5982\u4e0b\uff08<strong>\u6807\u51c6\u7248<\/strong>\uff09\uff1a<\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/12880e58bde540b7bd155f07cfcddda9~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=llTNEgr5qQmCWEv9gEX8dF4jnF0%3D'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/12880e58bde540b7bd155f07cfcddda9~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=llTNEgr5qQmCWEv9gEX8dF4jnF0%3D\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"directory&#95;graph&#95;standard.png\" \/><\/div><\/p>\n<h4>\u591aApp\u7248<\/h4>\n<p><strong>\u4e00\u822c\u4e00\u4e2a\u516c\u53f8\u5e76\u975e\u4e00\u4e2aApp<\/strong>\uff0c\u6bd4\u5982<strong>\u5546\u57ce\u529f\u80fdApp<\/strong>\uff08\u4e00\u4e2a\u7528\u6237\u7aef\u3001\u4e00\u4e2a\u5546\u5bb6\u7aef\uff09\u3001<strong>\u5916\u5356\u529f\u80fdApp<\/strong>\uff08\u4e00\u4e2a\u7528\u6237\u7aef\u3001\u4e00\u4e2a\u9a91\u624b\u7aef\uff09\u3002\u4ee5<strong>\u5b57\u8282\u8df3\u52a8<\/strong>\u516c\u53f8\u4e3a\u4f8b\u5b50\uff0c\u5176\u4e2d\u516c\u53f8\u5f00\u53d1\u7684App\u6709<strong>\u6296\u97f3<\/strong>\u3001<strong>\u897f\u74dc\u89c6\u9891<\/strong>\u3001<strong>\u4eca\u65e5\u5934\u6761<\/strong>\u3001<strong>\u98de\u4e66<\/strong>\u3001<strong>\u526a\u6620<\/strong>\u7b49\u3002<\/p>\n<p>\u4e0a\u9762<strong>\u5b98\u65b9\uff08\u6807\u51c6\u7248\uff09<\/strong>\u7684<strong>\u6a21\u5757<\/strong>\u5212\u5206\uff0c\u5bfc\u81f4\u5185\u90e8\u7684<code>core<\/code>\u6a21\u5757\u542b\u6709<strong>\u672cApp\u7279\u6709<\/strong>\u7684\u3001<strong>\u6240\u6709App\u901a\u7528<\/strong>\u7684\u4ee3\u7801\u53ca\u8d44\u6e90\uff0c\u4ec5\u9002\u7528\u4e8e<strong>\u5355App<\/strong>\u67b6\u6784\u3002\u5982\u679c\u8981\u9002\u7528<strong>\u591aApp<\/strong>\u67b6\u6784\uff0c\u5c31\u9700\u8981\u628a<code>core<\/code>\u6a21\u5757\u5185<strong>\u6240\u6709App\u901a\u7528\u90e8\u5206<\/strong>\u63d0\u53d6\u51fa\u6765\uff0c\u63d0\u53d6\u540e\u7684\u9879\u76ee\uff0c\u9879\u76ee<strong>\u76ee\u5f55\u56fe<\/strong>\u5982\u4e0b\uff08<strong>\u591aApp\u7248<\/strong>\uff09\uff1a<\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/cd07d7410f3d4a219c5a565c9ee41d67~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=M11UyyfI171cTvoGTpJprhHHJDY%3D'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/cd07d7410f3d4a219c5a565c9ee41d67~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=M11UyyfI171cTvoGTpJprhHHJDY%3D\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"directory&#95;graph&#95;multi&#95;app.png\" \/><\/div><\/p>\n<blockquote><p>\n  \u53d8\u5316\u8bf4\u660e\uff1a<\/p>\n<ol>\n<li>\u628a<strong>\u6807\u51c6\u7248<\/strong>\u7684<strong>\u6296\u97f3<\/strong>\u7684\u6a21\u5757\u7ed3\u6784\uff0c\u5b58\u5230\u4e86<strong>\u6700\u5916\u5c42<\/strong><code>douyin<\/code><strong>\u76ee\u5f55<\/strong>\u3002<\/li>\n<li>\u628a\u4e00\u4e9b<strong>\u53ef\u6240\u6709App\u5171\u7528<\/strong>\u7684\u6a21\u5757\uff0c\u5b58\u5230\u4e86<strong>\u6700\u5916\u5c42<\/strong><code>core<\/code><strong>\u76ee\u5f55<\/strong>\u3002<\/li>\n<li>\u628a<strong>\u6807\u51c6\u7248<\/strong>\u7684<strong>\u897f\u74dc\u89c6\u9891<\/strong>\u7684\u6a21\u5757\u7ed3\u6784\uff0c\u5b58\u5230\u4e86<strong>\u6700\u5916\u5c42<\/strong><code>xigua<\/code><strong>\u76ee\u5f55<\/strong>\u3002<\/li>\n<\/ol>\n<\/blockquote>\n<p><strong>\u76ee\u5f55\u8bf4\u660e\uff1a<\/strong><\/p>\n<ul>\n<li><strong>\u6700\u5916\u5c42<\/strong><code>core<\/code><strong>\u76ee\u5f55<\/strong>\uff1a\u4e3a<strong>\u6240\u6709App<\/strong>\u90fd\u53ef\u4ee5\u4f7f\u7528\u7684\u4ee3\u7801\u53ca\u8d44\u6e90\uff0c<strong>\u5185\u90e8\u6a21\u5757<\/strong>\u88ab<strong>\u6240\u6709App<\/strong>\u5185\u7684<code>core<\/code><strong>\u6a21\u5757<\/strong>\u4f9d\u8d56\u3002<\/li>\n<li><strong>\u6700\u5916\u5c42<\/strong><code>douyin<\/code><strong>\u76ee\u5f55<\/strong>\uff1a\u4e3a <strong>\u6296\u97f3App\u81ea\u5df1\u72ec\u6709\uff08\u7279\u6709\uff09<\/strong> \u7684\u76f8\u5173\u4ee3\u7801\u53ca\u8d44\u6e90\u3002\n<ul>\n<li><code>core<\/code><strong>\u6a21\u5757<\/strong>\uff1a\u4f9d\u8d56<strong>\u6700\u5916\u5c42<\/strong><code>core<\/code><strong>\u76ee\u5f55<\/strong>\u5185\u7684\u6a21\u5757\uff0c<strong>\u53cd\u4e4b\u4e0d\u884c<\/strong>\u3002<\/li>\n<li><code>app<\/code><strong>\u6a21\u5757<\/strong>\u3001<code>feature<\/code><strong>\u6a21\u5757<\/strong>\uff1a\u76f4\u63a5\u4f9d\u8d56<strong>\u6296\u97f3\u5185\u90e8<\/strong><code>core<\/code>\u6a21\u5757\u5373\u53ef\uff0c\u6b64\u4e3a<strong>\u6700\u5916\u5c42<\/strong><code>core<\/code><strong>\u76ee\u5f55<\/strong>\u7684<strong>\u529f\u80fd\u5b9a\u5236<\/strong>\uff0c\u5982\uff1a\u76f4\u63a5\u4f9d\u8d56<strong>\u6296\u97f3App<\/strong>\u7684<code>:douyin:core:architecture<\/code>\u6a21\u5757\u5373\u53ef\uff0c\u6b64\u6a21\u5757\u4e3a<strong>\u6296\u97f3App<\/strong>\u5bf9<code>:core:architecture<\/code>\u6a21\u5757\uff08<strong>\u6240\u6709App\u901a\u7528\u7684-\u67b6\u6784\u6a21\u5757<\/strong>\uff09\u7684<strong>\u5b9a\u5236<\/strong>\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u6700\u5916\u5c42<\/strong><code>xigua<\/code><strong>\u76ee\u5f55<\/strong>\uff1a\u4e3a<strong>\u897f\u74dc\u89c6\u9891App<\/strong>\u7684\u76f8\u5173\u4ee3\u7801\uff0c\u89c4\u5219\u540c\u4e0a\uff08\u6296\u97f3\uff09\u3002<\/li>\n<\/ul>\n<blockquote><p>\n  \u8bf4\u660e\uff1a\u8fd8\u53ef\u4ee5\u5728<strong>\u6700\u5916\u5c42<\/strong>\u7ee7\u7eed\u5f00\u53d1\u5176\u5b83App\uff0c\u5982<strong>\u4eca\u65e5\u5934\u6761<\/strong>\u3001<strong>\u98de\u4e66<\/strong>\u3001<strong>\u526a\u6620<\/strong>\u7b49\uff0c\u89c4\u5219\u540c\u4e0a\uff08\u6296\u97f3\u3001\u897f\u74dc\u89c6\u9891\uff09\u3002\n<\/p><\/blockquote>\n<h4>\u53ef\u79fb\u9664\u7248<\/h4>\n<p>\u5728\u9879\u76ee\u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u5982\u679c\u4f60<strong>\u4e0d\u770b\u597d<\/strong>\u8981\u5f00\u53d1\u7684\u529f\u80fd\uff0c\u6216\u8005\u9886\u5bfc\u3001\u4ea7\u54c1\u544a\u8bc9\u4f60\uff0c\u8981\u5f00\u53d1\u7684\u529f\u80fd<strong>\u4e4b\u540e\u53ef\u80fd\u4f1a\u79fb\u9664<\/strong>\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u6b64\u8bbe\u8ba1\u3002<\/p>\n<p>\u4ee5<strong>\u6296\u97f3App<\/strong>\u4e3a\u4f8b\uff0c<strong>\u6700\u65e9<\/strong>\u7684<strong>\u6296\u97f3<\/strong>\u662f\u6ca1\u6709<strong>\u5546\u57ce<\/strong>\u529f\u80fd\u7684\uff0c\u5982\u679c\u4ee5<strong>\u5546\u57ce<\/strong>\u529f\u80fd\u4e4b\u540e\u4f1a<strong>\u79fb\u9664<\/strong>\u6765\u5f00\u53d1\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6a21\u5757\u8bbe\u8ba1\u3002<\/p>\n<p>\u73b0\u5728\u7684\u9879\u76ee\uff0c\u9879\u76ee<strong>\u76ee\u5f55\u56fe<\/strong>\u5982\u4e0b\uff08<strong>\u53ef\u79fb\u9664\u7248<\/strong>\uff09\uff1a<\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/aa642066d69041d585f5602328fb5f07~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=V91TAAqVVKVHZOBpuNU%2ByLYKrJY%3D'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/aa642066d69041d585f5602328fb5f07~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=V91TAAqVVKVHZOBpuNU%2ByLYKrJY%3D\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"directory&#95;graph&#95;removable.png\" \/><\/div><\/p>\n<blockquote><p>\n  \u53d8\u5316\u8bf4\u660e\uff1a<\/p>\n<ol>\n<li>\u628a<strong>\u53ef\u80fd\u8981\u79fb\u9664\u7684shop\u529f\u80fd<\/strong>\u7684\u6a21\u5757\u7ed3\u6784\uff0c\u5b58\u5230\u4e86<strong>\u6700\u5916\u5c42<\/strong><code>douyin<\/code><strong>\u76ee\u5f55<\/strong>\u3002<\/li>\n<\/ol>\n<\/blockquote>\n<p><strong>\u65b0\u589e\u7684shop\u76ee\u5f55\u8bf4\u660e\uff1a<\/strong><\/p>\n<ul>\n<li><code>core<\/code><strong>\u6a21\u5757<\/strong>\uff1a<strong>\u53ef\u4ee5\u4f9d\u8d56\u6296\u97f3\u3001\u5546\u57cecore\u6a21\u5757\uff0c\u4f46\u662f\u6296\u97f3core\u6a21\u5757\u4e0d\u80fd\u4f9d\u8d56\u5546\u57cecore\u6a21\u5757\uff08\u4ee5\u4fbf\u597d\u5728\u6296\u97f3\u5185\u79fb\u9664\uff09<\/strong>\u3002<\/li>\n<li><code>feature<\/code><strong>\u6a21\u5757<\/strong>\uff1a<strong>\u540c\u7ea7feature\u95f4\u4e0d\u80fd\u76f8\u4e92\u4f9d\u8d56\uff0c\u53ea\u80fd\u4f9d\u8d56\u6296\u97f3\u3001\u5546\u57cecore\u6a21\u5757<\/strong>\u3002<\/li>\n<\/ul>\n<p>\u53ef\u4ee5<strong>\u4fee\u6539\u9879\u76ee\u6839\u76ee\u5f55<\/strong>\u4e0b<code>gradle.properties<\/code>\u5185<code>isShopInclude<\/code>\u4e3a<code>false<\/code>\u3001<code>isRouterReflect<\/code>\u4e3a<code>true<\/code>\uff0c\u6765\u6f14\u793a\u6b64<strong>\u79fb\u9664\u529f\u80fd<\/strong>\u3002<\/p>\n<pre><code class=\"language-groovy\">isShopInclude = false\nisRouterReflect = true\n<\/code><\/pre>\n<blockquote><p>\n  \u8bf4\u660e\uff1a<\/p>\n<p>  <code>isShopInclude<\/code>\uff1a\u4e3a\u662f\u5426<strong>\u5305\u62ec\u5546\u57ce<\/strong>\u3002<\/p>\n<p>  <code>isRouterReflect<\/code>\uff1a\u4e3a\u662f\u5426<code>Router<\/code><strong>\u53cd\u5c04\u5b9e\u73b0<\/strong>\u3002<\/p>\n<ul>\n<li>\u672c\u9879\u76ee<code>Router<\/code>\u7684\u5b9e\u73b0\u5206\u4e3a\u4e86\u4e24\u79cd\uff0c<strong>Dagger\u5b9e\u73b0<\/strong>\uff08<strong>\u6b63\u5f0f<\/strong>\u7528\uff09\u3001<strong>\u53cd\u5c04\u5b9e\u73b0<\/strong>\uff08<strong>\u6d4b\u8bd5<\/strong>\u7528\uff09\uff0c\u8be6\u7ec6\u770b<code>router<\/code>\u6a21\u5757\u3002<\/li>\n<\/ul>\n<\/blockquote>\n<h3>\u6a21\u5757\u5305\u540d<\/h3>\n<p>\u5305\u540d\u683c\u5f0f\u4e00\u822c\u4e3a\uff1a<strong>\u57df\u540d\u53cd\u8f6c+\u9879\u76ee\u540d+\u529f\u80fd\u540d<\/strong>\uff0c\u4ee5\u6b64<strong>\u5b57\u8282\u8df3\u52a8<\/strong>\uff08\u57df\u540d\uff1a<a href=\"http:\/\/www.bytedance.com\">www.bytedance.com<\/a> \uff09\u516c\u53f8<strong>\u6296\u97f3<\/strong>\u9879\u76ee\u4e3a\u4f8b\uff0c\u89c4\u5219\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li><code>core<\/code>\uff1a<strong>com.bytedance.core.xxx<\/strong>\uff08<strong>\u548c\u7279\u5b9aApp\u65e0\u5173<\/strong>\uff09\uff0c\u5982\uff1acom.bytedance.core.architecture<\/li>\n<li><code>douyin<\/code>\uff1acom.bytedance.<strong>douyin.xxx<\/strong>\uff08<strong>\u548c\u7279\u5b9aApp\u6709\u5173<\/strong>\uff09\n<ul>\n<li><code>app<\/code>\uff1acom.bytedance.<strong>douyin<\/strong><\/li>\n<li><code>core<\/code>\uff1acom.bytedance.<strong>douyin.core<\/strong>.xxx\uff0c\u5982\uff1acom.bytedance.douyin.core.architecture<\/li>\n<li><code>feature<\/code>\uff1acom.bytedance.<strong>douyin.feature<\/strong>.xxx\uff0c\u5982\uff1acom.bytedance.douyin.feature.home<\/li>\n<li><code>shop<\/code>\uff1acom.bytedance.<strong>douyin.shop<\/strong>.xxx\n<ul>\n<li><code>core<\/code>\uff1acom.bytedance.<strong>douyin.shop.core<\/strong>.xxx\uff0c\u5982\uff1acom.bytedance.douyin.shop.core.data<\/li>\n<li><code>feature<\/code>\uff1acom.bytedance.<strong>douyin.shop.feature<\/strong>.xxx\uff0c\u5982\uff1acom.bytedance.douyin.shop.feature.shop<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li><code>xigua<\/code>\uff1a\u89c4\u5219\u540c\u4e0a\uff08\u6296\u97f3\uff09<\/li>\n<\/ul>\n<h3>\u6a21\u5757\u529f\u80fd<\/h3>\n<ul>\n<li><code>app<\/code>\uff1a\u9879\u76ee\u7684\u5165\u53e3\uff0c\u542b\u6709<code>MainActivity<\/code>\u3001<code>Application<\/code>\u7b49\u3002<\/li>\n<li><code>core<\/code>\n<ul>\n<li><code>architecture<\/code>\uff1a\u67b6\u6784\u76f8\u5173\uff0c\u5305\u542b\u4e00\u4e9b\u57fa\u7840\u7c7b\uff0c\u5982\uff1a\u6700\u5916\u5c42<code>:core:architecture<\/code>\u6a21\u5757\u5305\u542b\u901a\u7528\u7684<code>BaseViewsActivity<\/code>\u3001<code>BaseViewsFragment<\/code>\u7b49\uff0c\u6296\u97f3\u5c42<code>:douyin:core:architecture<\/code>\u6a21\u5757\u5305\u542b<strong>\u6296\u97f3<\/strong>\u5b9a\u5236\u7684<code>AppViewsActivity<\/code>\u3001<code>AppViewsFragment<\/code>\u7b49\u3002<\/li>\n<li><code>architecture-reflect<\/code>\uff1a\u67b6\u6784\u53cd\u5c04\u5b9e\u73b0\u76f8\u5173\uff0c\u5305\u542b\u4e00\u4e9b\u67b6\u6784\u5185\u7684\u53cd\u5c04\u5b9e\u73b0\uff0c\u5982\uff1a<code>reflectInflateViewBinding<\/code>\uff08\u53cd\u5c04\u5b9e\u73b0<code>ViewBinding<\/code>\uff09\u3001<code>reflectViewModels<\/code>\uff08\u53cd\u5c04\u5b9e\u73b0<code>ViewModel<\/code>\uff09\u3002<\/li>\n<li><code>common<\/code>\uff1a\u901a\u7528\u76f8\u5173\uff0c\u5305\u542b\u4e00\u4e9b\u901a\u7528\u7c7b\u3001\u5de5\u5177\u7c7b\u7b49\u3002<\/li>\n<li><code>designsystem<\/code>\uff1a\u8bbe\u8ba1\u7cfb\u7edf\u76f8\u5173\uff0c\u5305\u542b\u63a7\u4ef6\u3001\u4e3b\u9898\u7b49\u3002<\/li>\n<li><code>model<\/code>\uff1a<code>Model<\/code>\u7c7b\u76f8\u5173\uff0c\u5305\u542b<code>Model<\/code>\u7c7b\u7b49\u3002<\/li>\n<li><code>network<\/code>\uff1a\u7f51\u7edc\u76f8\u5173\uff0c\u5305\u542b<code>NetworkDataSource<\/code>\u3001\u7f51\u7edc\u5de5\u5177\u7c7b\u3001\u56fe\u7247\u52a0\u8f7d\u7b49\u3002<\/li>\n<li><code>test<\/code>\uff1a\u6d4b\u8bd5\u9875\u9762\u76f8\u5173\uff08\u4e3a\u4e86\u7ed9\u672a\u5b9e\u73b0\u7684\u529f\u80fd\uff0c\u5360\u4f4d\u7528\uff09\uff0c\u5305\u542b<code>TestActivity<\/code>\u3001<code>TestFragment<\/code>\u7b49\u3002<\/li>\n<li><code>webview<\/code>\uff1a\u7f51\u9875\u76f8\u5173\uff0c\u5305\u542b\u7f51\u9875\u7684\u8df3\u8f6c\u3001\u914d\u7f6e\u7b49\u3002<\/li>\n<li><code>data<\/code>\uff1a\u6570\u636e\u76f8\u5173\uff0c\u5305\u542b<code>Repository<\/code>\u7c7b\u7b49\u3002<\/li>\n<li><code>datastore<\/code>\uff1a<code>DataStore<\/code>\u5b58\u50a8\u76f8\u5173\uff0c\u5305\u542b<code>PreferencesDataSource<\/code>\u7b49\u3002<\/li>\n<li><code>datastore-proto<\/code>\uff1a<code>DataStore<\/code>\u7684<code>proto<\/code>\u914d\u7f6e\u76f8\u5173\uff0c\u5305\u542b<code>user.proto<\/code>\u914d\u7f6e\u7b49\u3002<\/li>\n<li><code>feature-single<\/code>\uff1a\u5355\u72ec\u6a21\u5757\u8fd0\u884c\u901a\u7528\u914d\u7f6e\u76f8\u5173\uff0c\u5305\u542b<code>TestFragmentDetailsAndroidEntryPointActivity<\/code>\u7b49\u3002<\/li>\n<li><code>login<\/code>\uff1a\u767b\u5f55\u76f8\u5173\uff0c\u5305\u542b\u767b\u5f55\u68c0\u6d4b\u3001\u5f53\u524d\u767b\u5f55\u72b6\u6001\u3001\u9000\u51fa\u767b\u5f55\u7b49\u3002<\/li>\n<li><code>router<\/code>\uff1a\u8def\u7531\u7cfb\u7edf\u76f8\u5173\uff0c\u5305\u542b<code>Router<\/code>\u7684<strong>Dagger\u5b9e\u73b0<\/strong>\u3001<strong>\u53cd\u5c04\u5b9e\u73b0<\/strong>\u7b49\u3002<\/li>\n<\/ul>\n<\/li>\n<li><code>feature<\/code>\uff1a\u529f\u80fd\u4e1a\u52a1\uff0c\u5305\u542bUI\u3001<code>ViewModel<\/code>\u7b49\u3002<\/li>\n<\/ul>\n<h3>Feature\u6a21\u5757\u95f4\u901a\u4fe1\u4ecb\u7ecd<\/h3>\n<p><code>Feature<\/code>\u6a21\u5757\u95f4\u901a\u4fe1\uff0c\u4f7f\u7528<code>router<\/code>\u6a21\u5757\u7684<code>Router<\/code>\u7c7b\u8fdb\u884c\u901a\u4fe1\uff0c\u4ee5<code>home<\/code>\u6a21\u5757\u4e3a\u4f8b\u89c4\u5219\u5982\u4e0b\uff1a<\/p>\n<h4>\u5b9a\u4e49<\/h4>\n<pre><code class=\"language-kotlin\">interface HomeRouter {\n    fun createHomeFragment(): Fragment\n}\n<\/code><\/pre>\n<p>\u6b64<code>HomeRouter<\/code>\u63a5\u53e3\u4e3a<code>home<\/code>\u6a21\u5757<strong>\u5bf9\u5916\u66b4\u9732<\/strong>\u7684<strong>\u53ef\u4f9b\u5176\u5b83\u6a21\u5757\u8c03\u7528<\/strong>\u90e8\u5206\uff0c\u5728<code>router<\/code>\u6a21\u5757\u5185\u5b9a\u4e49\uff0c\u5982\u679c\u8fd8\u6709\u5176\u5b83\u7684\uff0c\u53ef\u7ee7\u7eed\u5728\u6b64\u63a5\u53e3\u5185\u6dfb\u52a0\uff0c\u5982\uff1a<code>createXXXFragment<\/code>\u3001<code>startXXXActivity<\/code>\u65b9\u6cd5\u7b49\u3002<\/p>\n<h4>\u771f\u7684\u5b9e\u73b0<\/h4>\n<pre><code class=\"language-kotlin\">class DefaultHomeRouter : HomeRouter {\n    override fun createHomeFragment(): Fragment = HomeFragment.newInstance()\n}\n<\/code><\/pre>\n<p>\u6b64<code>DefaultHomeRouter<\/code>\u7c7b\u4e3a<code>HomeRouter<\/code>\u63a5\u53e3<strong>\u771f\u7684\u5b9e\u73b0<\/strong>\uff0c\u5728<code>home<\/code>\u6a21\u5757\u5185\u5b9e\u73b0\u3002<\/p>\n<h4>\u5047\u7684\u5b9e\u73b0<\/h4>\n<pre><code class=\"language-kotlin\">class FakeHomeRouter : HomeRouter {\n    override fun createHomeFragment(): Fragment = AppTestFragment.newInstance(\"Home\")\n}\n<\/code><\/pre>\n<p>\u6b64<code>FakeHomeRouter<\/code>\u7c7b\u4e3a<code>HomeRouter<\/code>\u63a5\u53e3<strong>\u5047\u7684\u5b9e\u73b0<\/strong>\uff0c\u5728<code>router<\/code>\u6a21\u5757\u7684<code>router-reflect<\/code>\u5185\u5b9e\u73b0\uff0c\u5185\u90e8\u4f7f\u7528\u7684<code>AppTestFragment<\/code>\u4ec5\u662f<strong>\u4e3a\u4e86\u663e\u793a\u65f6\u5360\u4f4d\u7528<\/strong>\u3002<\/p>\n<blockquote><p>\n  \u8bf4\u660e\uff1a<\/p>\n<p>  <strong>Router-Dagger\u5b9e\u73b0<\/strong>\uff1a\u4f7f\u7528<code>Dagger<\/code>\u627e<code>HomeRouter<\/code>\u7684\u5b9e\u73b0\uff08\u76ee\u524d\u63d0\u4f9b\u7684\u662f<code>DefaultHomeRouter<\/code>\uff09\uff0c\u5982\u679c\u627e\u4e0d\u5230<strong>\u4f1a\u62a5\u9519<\/strong>\u3002<\/p>\n<p>  <strong>Router-\u53cd\u5c04\u5b9e\u73b0<\/strong>\uff1a\u4f7f\u7528<strong>\u53cd\u5c04<\/strong>\u76f4\u63a5\u627e<code>DefaultHomeRouter<\/code>\uff0c\u5982\u679c\u627e\u4e0d\u5230\u4f1a\u76f4\u63a5\u4f7f\u7528<code>FakeHomeRouter<\/code>\uff0c<strong>\u4e0d\u4f1a\u62a5\u9519<\/strong>\u3002\n<\/p><\/blockquote>\n<h4>\u8c03\u7528<\/h4>\n<pre><code class=\"language-kotlin\">val homeFragment = Router.Home.createHomeFragment()\n<\/code><\/pre>\n<h3>\u5355\u72ec\u8fd0\u884cFeature\u6a21\u5757\u4ecb\u7ecd<\/h3>\n<p>\u5982\u679c\u4f60\u53ea\u8d1f\u8d23\u67d0\u4e2a<code>Feature<\/code>\u6a21\u5757\uff0c\u6216\u8005\u60f3<strong>\u66f4\u89e3\u8026<\/strong>\u3001<strong>\u66f4\u5feb<\/strong>\u7684\u6d4b\u8bd5\u4f60\u7684\u529f\u80fd\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u6b64<strong>\u5355\u72ec\u8fd0\u884cFeature\u6a21\u5757<\/strong>\uff0c\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<h4>\u4fee\u6539\u914d\u7f6e<\/h4>\n<p>\u4fee\u6539<strong>\u9879\u76ee\u6839\u76ee\u5f55<\/strong>\u4e0b<code>gradle.properties<\/code>\u5185<code>isFeatureSingle<\/code>\u4e3a<code>true<\/code>\uff0c\u5e76<code>Sync<\/code>\u540c\u6b65<code>Gradle<\/code>\u3002<\/p>\n<pre><code class=\"language-groovy\">isFeatureSingle = true\n<\/code><\/pre>\n<blockquote><p>\n  \u8bf4\u660e\uff1a<\/p>\n<p>  <code>isFeatureSingle<\/code>\uff1a\u4e3a\u662f\u5426<strong>\u5355\u72ec\u8fd0\u884cFeature\u6a21\u5757<\/strong>\u3002\u5982\u679c<strong>\u5f00\u542f<\/strong>\uff0c\u5219<code>Router<\/code>\u4f7f\u7528<strong>\u53cd\u5c04\u5b9e\u73b0<\/strong>\uff0c\u4ee5\u4f7f\u5176\u8c03\u7528<strong>\u5176\u5b83\u6a21\u5757<\/strong>\u6ca1\u6709\u65f6<strong>\u4e0d\u4f1a\u62a5\u9519<\/strong>\uff0c\u800c\u662f\u4f7f\u7528<code>Fake<\/code>\u7684\u5b9e\u73b0\uff08\u5982\uff1a\u5360\u4f4d\u663e\u793a\uff09\u3002\n<\/p><\/blockquote>\n<h4>\u6dfb\u52a0\u6d4b\u8bd5\u5165\u53e3\u70b9<\/h4>\n<p>\u6b64\u529f\u80fd\u9700\u8981\u914d\u5408\u4f7f\u7528\u6211\u7684<a href=\"https:\/\/github.com\/zrq1060\/TestPoint\">TestPoint<\/a>\u5e93\u6765\u5b9e\u73b0\uff0c\u6dfb\u52a0<strong>\u6d4b\u8bd5\u5165\u53e3\u70b9<\/strong>\uff0c\u5373\u4f1a\u5728<strong>\u6d4b\u8bd5\u5217\u8868\u9875<\/strong>\u589e\u52a0\u4e00\u4e2a\u6309\u94ae\uff0c\u70b9\u51fb\u6309\u94ae\u8df3\u8f6c\u5230\u6b64<code>Activity<\/code>\u3001<code>Fragment<\/code>\uff0c<strong>\u5b9a\u5236\u6309\u94ae\u70b9\u51fb<\/strong>\u7b49\u8be6\u7ec6\u4f7f\u7528\u8bf7\u770b<a href=\"https:\/\/github.com\/zrq1060\/TestPoint\">TestPoint<\/a>\u3002<\/p>\n<p>\u5728\u76ee\u6807\u7c7b\u4e0a\u6dfb\u52a0<code>TestEntryPoint<\/code>\u6ce8\u89e3\uff0c\u5982<code>ShopFragment<\/code>\uff1a<\/p>\n<pre><code class=\"language-kotlin\">@TestEntryPoint(\"\u5546\u57ce\")\nclass ShopFragment{\n\n}\n<\/code><\/pre>\n<h4>\u8fd0\u884c<\/h4>\n<p><strong>\u5355\u4e2a\u8fd0\u884c\uff1a<\/strong><\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/3ade357a5ed04a46b83599f2907a67a9~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=ItWtzPivmKelOxpX%2FscuUy%2FN4NA%3D'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/3ade357a5ed04a46b83599f2907a67a9~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=ItWtzPivmKelOxpX%2FscuUy%2FN4NA%3D\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"feature&#95;single&#95;configurations.png\" \/><\/div><\/p>\n<p>\u9009\u62e9\u4e0a\u9762\u7684\u4e00\u4e2a\uff0c\u5e76\u8fd0\u884c\uff0c\u5982\uff1a\u9009\u62e9<code>douyin.shop.feature.shop<\/code>\uff0c\u5219<strong>\u8fd0\u884c\u6296\u97f3\u7684\u5546\u57ce\u529f\u80fd<\/strong>\uff08\u53ef\u4ee5\u6d4b\u8bd5<strong>\u5546\u57ce\u7684\u70b9\u51fbItem<\/strong>\u529f\u80fd\u7b49\uff09\u3002<\/p>\n<p><strong>\u591a\u4e2a\u8fd0\u884c\uff1a<\/strong><\/p>\n<p>\u70b9\u51fb\u53f3\u4fa7<code>Gradle<\/code>&#8211;<code>Tasks<\/code>&#8211;<code>install<\/code>&#8211;<code>installDebug<\/code>\uff0c<strong>\u6216<\/strong>\u6267\u884c\u5982\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code class=\"language-groovy\">.\\gradlew installDebug\n<\/code><\/pre>\n<p>\u6267\u884c\u5b8c\u540e\uff0c\u4f1a\u5728<strong>\u624b\u673a\u684c\u9762<\/strong>\u51fa\u73b0<strong>\u6240\u6709Feature\u6a21\u5757<\/strong>\u7684<code>App<\/code>\uff08\u5982\u5feb\u901f\u4ecb\u7ecd-\u5355\u72ec\u8fd0\u884cFeature\u6a21\u5757\u6f14\u793a\u56fe\u6240\u793a\uff09\uff0c<strong>\u70b9\u51fb<\/strong>\u67d0\u4e2a\u5373\u53ef\u6d4b\u8bd5\u67d0\u5355\u4e2a<strong>Feature<\/strong>\u6a21\u5757\u3002<\/p>\n<h2>\u6a21\u5757\u5185\u67b6\u6784<\/h2>\n<h3>\u5b98\u65b9\u67b6\u6784<\/h3>\n<p>\u6a21\u5757\u5185\u67b6\u6784\uff0c\u4f7f\u7528<strong>\u5b98\u65b9<\/strong>\u7684<a href=\"https:\/\/developer.android.com\/topic\/architecture#recommended-app-arch\">\u63a8\u8350\u67b6\u6784<\/a>\uff0c\u6709\u52a9\u4e8e\u6784\u5efa\u5f3a\u5927\u800c\u4f18\u8d28\u7684\u5e94\u7528\u3002<\/p>\n<blockquote><p>\n  <strong>\u5e94\u7528\u67b6\u6784<\/strong>\u76f8\u5173\uff0c\u8bf7\u770b\u5b98\u65b9\u7684 <a href=\"https:\/\/developer.android.com\/topic\/architecture\">\u5e94\u7528\u67b6\u6784\u6307\u5357<\/a>\u3002\n<\/p><\/blockquote>\n<p>\u5b98\u65b9\u7684<strong>\u67b6\u6784\u6982\u8ff0\u56fe<\/strong> \u5982\u4e0b\uff1a<\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/f9685152775943e1937efe4e7b930d61~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=eJzrMw86noxsb%2FvcY6YFO0TRV1c%3D'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/f9685152775943e1937efe4e7b930d61~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=eJzrMw86noxsb%2FvcY6YFO0TRV1c%3D\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"architecture&#95;overview.png\" \/><\/div><\/p>\n<p>\u5b98\u65b9\u67b6\u6784\u5206\u4e3a\u4e86\uff1a<strong>UI\u5c42<\/strong>\u3001<strong>Domain\u5c42<\/strong>\uff08\u53ef\u9009\uff09\u3001<strong>Data\u6570\u636e\u5c42<\/strong>\u3002<\/p>\n<h3>\u9879\u76ee\u67b6\u6784<\/h3>\n<p>\u672c\u9879\u76ee\uff0c\u76ee\u524d<strong>\u6ca1\u6709\u4f7f\u7528<\/strong><code>Domain<\/code>\u5c42\uff0c\u4e5f<strong>\u6ca1\u6709\u4f7f\u7528<\/strong><code>Room<\/code>\u5e93\uff0c\u76ee\u524d\u7684\u9879\u76ee<strong>\u67b6\u6784\u56fe<\/strong> \u5982\u4e0b\uff1a<\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/8d4a837c03d747b6bf8a91ef4a9d4890~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=uL4qWw%2BRix6nUAJFcmwRxPfcNg8%3D'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/p0-xtjj-private.juejin.cn\/tos-cn-i-73owjymdk6\/8d4a837c03d747b6bf8a91ef4a9d4890~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5byg6I2j5peX:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDQ1MDQ3OTEzMjY1MjY3OSJ9&#038;rk3s=f64ab15b&#038;x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&#038;x-orig-expires=1744767728&#038;x-orig-sign=uL4qWw%2BRix6nUAJFcmwRxPfcNg8%3D\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"architecture&#95;project.png\" \/><\/div><\/p>\n<h1>\u4f7f\u7528<\/h1>\n<h2>Activity\u3001Fragment<\/h2>\n<p>\u4ee5<code>demo<\/code>\u6a21\u5757\u7684<code>MainActivity<\/code>\u4e3a\u4f8b\uff1a<\/p>\n<pre><code class=\"language-kotlin\">package com.bytedance.demo.app.main\n\nimport android.view.LayoutInflater\nimport androidx.activity.viewModels\nimport com.bytedance.douyin.core.architecture.app.views.AppViewsActivity\nimport dagger.hilt.android.AndroidEntryPoint\n\/\/ \u8bbe\u7f6eas\u522b\u540d\uff0c\u4e00\u822c\u90fd\u662f\u8bbe\u7f6e\u8fd9\u51e0\u4e2a\u3002\n\/\/ \u4f7f\u7528\u522b\u540d\u540e\uff0c\u6b64\u7c7b\u7684\u6a21\u677f\uff0c\u4e0b\u9762\u7684\u4e0d\u9700\u8981\u6539\u4e86\uff0c\u53ea\u9700\u8981\u6539\u4e0a\u9762as\u8fd9\u91cc\u5373\u53ef\u3002\nimport com.bytedance.demo.app.main.MainUiState as UiState\nimport com.bytedance.demo.app.main.MainViewModel as ViewModel\nimport com.bytedance.demo.databinding.ActivityMainBinding as ViewBinding\n\n\/**\n * \u63cf\u8ff0\uff1a\n *\n * @author zhangrq\n * createTime 2025\/3\/24 11:14\n *\/\n@AndroidEntryPoint\nclass MainActivity : AppViewsActivity&lt;ViewBinding, UiState, ViewModel&gt;() {\n    \/\/ \u5728\u7236\u7c7bAppViewsActivity\u4e2d\uff0c\u53ef\u7528\u53cd\u5c04\u5b9e\u73b0\uff08reflectViewModels()\uff09\uff0c\u7701\u7565\u6b64\u5b9e\u73b0\u3002\n    override val viewModel: ViewModel by viewModels()\n\n    \/\/ \u5728\u7236\u7c7bAppViewsActivity\u4e2d\uff0c\u53ef\u7528\u53cd\u5c04\u5b9e\u73b0\uff08reflectInflateViewBinding()\uff09\uff0c\u7701\u7565\u6b64\u5b9e\u73b0\u3002\n    override fun inflateViewBinding(inflater: LayoutInflater) = ViewBinding.inflate(inflater)\n\n    \/\/ \u521d\u59cb\u5316View\uff08\u53ef\u4ee5\u5728\u91cc\u9762\u76f4\u63a5\u62ff\u5230\u5f53\u524d\u9875\u9762\u5e03\u5c40\u63a7\u4ef6\uff09\n    override fun ViewBinding.initViews() {\n        \/\/ \u8bbe\u7f6eTextView\u63a7\u4ef6\n        content.textSize = 50f\n\/\/        content.setTextColor(Color.BLACK)\n    }\n\n    \/\/ \u521d\u59cb\u5316Listener\uff08\u53ef\u4ee5\u5728\u91cc\u9762\u76f4\u63a5\u62ff\u5230\u5f53\u524d\u9875\u9762\u5e03\u5c40\u63a7\u4ef6\uff09\n    override fun ViewBinding.initListeners() {\n        \/\/ \u8bbe\u7f6eTextView\u70b9\u51fb\n        content.setOnClickListener {\n            \/\/ \u663e\u793aToast\uff0c\u6b64Toast\u548c\u5f53\u524d\u9875\u9762\u7684\u751f\u547d\u5468\u671f\u7ed1\u5b9a\uff0c\u5f53\u524d\u9875\u9762\u4e0d\u53ef\u89c1\uff0cToast\u5173\u95ed\u3002\n            viewModel.showMessage(\"Long Toast\", isShort = false)\n        }\n    }\n\n    \/\/ \u521d\u59cb\u5316Observer\uff08\u53ef\u4ee5\u5728\u91cc\u9762\u76f4\u63a5\u62ff\u5230\u5f53\u524d\u9875\u9762\u5e03\u5c40\u63a7\u4ef6\uff09\uff0c\u7528\u4e8e\u89c2\u5bdf\uff08\u6536\u96c6\uff09ViewModel\u5185\u7684\u66b4\u9732\u7684\u5c5e\u6027\u503c\uff08Flow\u503c\uff09\u3002\n    override fun ViewBinding.initObservers() {\n    }\n\n    \/\/ \u6536\u96c6UiState\u7684\u503c\uff08\u53ef\u4ee5\u5728\u91cc\u9762\u76f4\u63a5\u62ff\u5230\u5f53\u524d\u9875\u9762\u5e03\u5c40\u63a7\u4ef6\uff09\uff0c\u7528\u4e8e\u8bbe\u7f6e\u5f53\u524d\u9875\u9762\u7684\u6570\u636e\u3002\n    override fun ViewBinding.onUiStateCollect(uiState: UiState) {\n        \/\/ \u8bbe\u7f6eTextView\u7684\u503c\n        content.text = uiState.tabs?.joinToString()\n    }\n}\n<\/code><\/pre>\n<blockquote><p>\n  <code>Activity<\/code>\u3001<code>Fragment<\/code>\u3001<code>DialogFragment<\/code>\u7684<strong>\u4f7f\u7528\u89c4\u5219\u76f8\u540c<\/strong>\uff0c\u4ee5<code>Activity<\/code>\u4e3a\u4f8b\uff0c\u8bf4\u660e\u5982\u4e0b\uff1a<\/p>\n<ol>\n<li><code>MainActivity<\/code>\u76f4\u63a5\u7ee7\u627f<strong>App\u7ea7<\/strong>\u7684<code>AppViewsActivity<\/code>\uff0c\u6b64\u7c7b\u4e3a<strong>\u6296\u97f3<\/strong>\u9879\u76ee\u5bf9<strong>\u901a\u7528\u7ea7<\/strong>\u7684<code>BaseViewsActivity<\/code>\u7684<strong>\u5b9a\u5236<\/strong>\u3002<\/li>\n<li><code>ViewModel<\/code>\u3001<code>ViewBinding<\/code>\u7684<strong>\u521b\u5efa<\/strong>\uff0c\u7531\u4e8e\u672c\u9879\u76ee<strong>\u4e3a\u4e86\u6027\u80fd\u6ca1\u6709\u4f7f\u7528\u53cd\u5c04<\/strong>\uff0c\u6240\u4ee5\u9700\u8981\u5728<strong>\u6bcf\u4e2a\u5b50\u7c7b\u4e2d\u81ea\u5df1\u5b9e\u73b0<\/strong>\uff0c\u53ef\u4ee5\u5728<strong>App\u7ea7<\/strong>\u7684<code>AppViewsActivity<\/code>\u5185\u4f7f\u7528<code>reflectInflateViewBinding<\/code>\u3001<code>reflectViewModels<\/code><strong>\u53cd\u5c04\u5b9e\u73b0<\/strong>\uff0c\u8fd9\u6837\u5c31<strong>\u53ef\u4ee5\u5728\u6bcf\u4e2a\u5b50\u7c7b<\/strong>\u4e2d\u7701\u7565<code>ViewModel<\/code>\u3001<code>ViewBinding<\/code>\u7684<strong>\u521b\u5efa\u4ee3\u7801<\/strong>\u3002<\/li>\n<li><strong>\u521d\u59cb\u5316\u7cfb\u5217\u65b9\u6cd5<\/strong>\uff0c\u4f7f\u7528<code>ViewBinding<\/code>\u6269\u5c55\u65b9\u6cd5\uff0c\u662f\u4e3a\u4e86\u80fd\u8ba9\u5176<strong>\u5728\u65b9\u6cd5\u5185\u76f4\u63a5\u83b7\u53d6\u5230<\/strong><code>xxx<\/code><strong>\u63a7\u4ef6<\/strong>\uff0c\u800c\u4e0d\u7528\u901a\u8fc7<code>binding.xxx<\/code>\u83b7\u53d6\uff0c\u4ee5<strong>\u66f4\u65b9\u4fbf<\/strong>\u7684<strong>\u64cd\u4f5c\u63a7\u4ef6<\/strong>\u3002<\/li>\n<li><code>XXXBinding<\/code>\u3001<code>XXXUiState<\/code>\u3001<code>XXXViewModel<\/code>\uff0c\u5168\u90e8\u901a\u8fc7<strong>as\u522b\u540d<\/strong>\u6765\u547d\u540d\uff0c<strong>\u7b80\u5316\u4e86\u540d\u5b57\u957f\u5ea6<\/strong>\uff0c<strong>\u7edf\u4e00\u4e86\u4ee3\u7801\u6837\u5f0f\u4e00\u81f4\u6027<\/strong>\uff0c\u8fd9\u6837<strong>\u65b0\u7c7b<\/strong>\u53ea\u9700\u8981<strong>\u4fee\u6539\u6a21\u677f\u7c7b\u4e0a\u9762as\u522b\u540d<\/strong>\u5373\u53ef\u3002<\/li>\n<\/ol>\n<\/blockquote>\n<h2>ViewModel<\/h2>\n<p>\u4ee5<code>demo<\/code>\u6a21\u5757\u7684<code>MainViewModel<\/code>\u4e3a\u4f8b\uff1a<\/p>\n<pre><code class=\"language-kotlin\">package com.bytedance.demo.app.main\n\nimport com.bytedance.douyin.core.architecture.app.AppViewModel\nimport com.bytedance.douyin.core.data.repository.interfaces.MainRepository\nimport com.bytedance.douyin.core.model.MainTabType\nimport dagger.hilt.android.lifecycle.HiltViewModel\nimport kotlinx.coroutines.flow.Flow\nimport kotlinx.coroutines.flow.map\nimport javax.inject.Inject\n\/\/ \u8bbe\u7f6eas\u522b\u540d\nimport com.bytedance.demo.app.main.MainUiState as UiState\n\n\/**\n * \u63cf\u8ff0\uff1a\n *\n * @author zhangrq\n * createTime 2025\/3\/24 11:14\n *\/\n@HiltViewModel\nclass MainViewModel @Inject constructor(mainRepository: MainRepository) : AppViewModel&lt;UiState&gt;() {\n\n    override val uiStateInitialValue: UiState = UiState() \/\/ UiState-\u521d\u59cb\u5316\u503c\n\n    \/\/ \u4eceMainRepository\u83b7\u53d6\u7684\u672c\u5730\u6d41\uff0c\u672c\u5730\u6570\u636e\u6539\uff0cUI\u6539\u3002\n    override val uiStateFlow: Flow&lt;UiState&gt; = mainRepository.getMainTabsStream().map {\n        \/\/ UiState-\u9875\u9762\u503c\n        UiState(tabs = it)\n    }\n}\n\n\/\/ Main-UiState\ndata class MainUiState(\n    val tabs: List&lt;MainTabType&gt;? = null,\n)\n<\/code><\/pre>\n<blockquote><p>\n  \u8bf4\u660e\uff1a<\/p>\n<ol>\n<li><code>ViewModel<\/code>\u76f4\u63a5\u7ee7\u627f<strong>App\u7ea7<\/strong>\u7684<code>AppViewModel<\/code>\uff0c\u6b64\u7c7b\u4e3a<strong>\u6296\u97f3<\/strong>\u9879\u76ee\u5bf9<strong>\u901a\u7528\u7ea7<\/strong>\u7684<code>BaseViewModel<\/code>\u7684<strong>\u5b9a\u5236<\/strong>\u3002<\/li>\n<li><code>uiStateInitialValue<\/code>\u4e3a<code>UiState<\/code>\u7684\u521d\u59cb\u5316\u503c\uff0c\u4e00\u822c\u4e3a<strong>\u9ed8\u8ba4\u7684<\/strong><code>UiState<\/code><strong>\u5bf9\u8c61<\/strong>\u3002<\/li>\n<li><code>uiStateFlow<\/code>\u4e3a<code>UiState<\/code>\u7684<code>Flow<\/code>\u6d41\uff0c\u5b83\u53d8\u5316\u4f1a\u5f71\u54cd\u5230<code>Activity<\/code>\u3001<code>Fragment<\/code>\u7684<code>onUiStateCollect()<\/code>\uff0c\u4e00\u822c\u4e3a<code>Flow<\/code>\uff08<strong>\u5355\u4e2a<\/strong><code>Flow<\/code>\u3001\u4f7f\u7528<code>combine()<\/code>\u89c2\u5bdf<strong>\u591a\u4e2a<\/strong><code>Flow<\/code>\uff09\u7684<code>map()<\/code>\u8f6c\u4e3a<code>UiState<\/code>\u7684<code>Flow<\/code>\u3002<\/li>\n<li><code>XXXUiState<\/code>\uff0c\u901a\u8fc7<strong>as\u522b\u540d<\/strong>\u6765\u547d\u540d\uff0c<strong>\u7b80\u5316\u4e86\u540d\u5b57\u957f\u5ea6<\/strong>\uff0c<strong>\u7edf\u4e00\u4e86\u4ee3\u7801\u6837\u5f0f\u4e00\u81f4\u6027<\/strong>\uff0c\u8fd9\u6837<strong>\u65b0\u7c7b<\/strong>\u53ea\u9700\u8981<strong>\u4fee\u6539\u6a21\u677f\u7c7b\u4e0a\u9762as\u522b\u540d<\/strong>\u5373\u53ef\u3002<\/li>\n<\/ol>\n<\/blockquote>\n<h2>\u751f\u547d\u5468\u671fToast\u3001Snackbar<\/h2>\n<p><strong>\u76f4\u63a5\u663e\u793a<\/strong><code>Toast<\/code>\u3001<code>Snackbar<\/code>\uff0c\u662f\u6ca1\u6709<strong>\u751f\u547d\u5468\u671f\u63a7\u5236<\/strong>\u7684\uff08<strong>\u53ea\u8d1f\u8d23\u663e\u793a<\/strong>\uff09\uff0c\u5373\u4f7f<code>Activiy<\/code>\u3001<code>Fragment<\/code><strong>\u4e0d\u53ef\u89c1<\/strong>\uff08\u88ab\u9500\u6bc1\u3001\u56de\u5230\u540e\u53f0\uff09\uff0c<strong>\u4e5f\u8fd8\u5728\u663e\u793a<\/strong>\u3002\u6211\u589e\u52a0\u4e86<strong>\u751f\u547d\u5468\u671f\u6d88\u606f\u663e\u793a<\/strong>\uff0c\u4ec5\u5728<code>Activiy<\/code>\u3001<code>Fragment<\/code><strong>\u53ef\u89c1\u65f6\u663e\u793a<\/strong>\u3002<\/p>\n<h3>\u6307\u5b9a\u6d88\u606f\u7684\u663e\u793a<\/h3>\n<p><strong>\u6307\u5b9a\u6d88\u606f\u7684\u663e\u793a<\/strong>\uff0c\u662f\u4f7f\u7528<code>Toast<\/code>\uff0c\u8fd8\u662f<code>Snackbar<\/code>\uff0c\u76ee\u524d<strong>\u9ed8\u8ba4<\/strong>\u4e3a<code>Toast<\/code>\u3002<\/p>\n<ul>\n<li><strong>\u5168\u5c40\u6d88\u606f\u6307\u5b9a<\/strong>\uff0c\u5728<code>BaseGlobalMessageInitializer<\/code>\u7c7b\u8bbe\u7f6e\u3002<\/li>\n<li><strong>\u751f\u547d\u5468\u671f\u6d88\u606f\u6307\u5b9a<\/strong>\uff0c\u5728<code>App<\/code>\u7ea7\u7684<code>AppViewsActivity<\/code>\u3001<code>AppViewsFragment<\/code>\u3001<code>AppViewsDialogFragment<\/code><strong>\u91cd\u5199<\/strong><code>messageCollector<\/code>\u7684\u5b9e\u73b0\u3002<\/li>\n<\/ul>\n<h3>\u4f7f\u7528\u6d88\u606f<\/h3>\n<pre><code class=\"language-kotlin\">\/\/ \u5168\u5c40\u6d88\u606f\uff0c\u4e0d\u53d7Activiy\u3001Fragment\u7684\u751f\u547d\u5468\u671f\u5f71\u54cd\u3002\nMessageManager.showGlobalMessage(\"Global Message\")\n\/\/ \u751f\u547d\u5468\u671f\u6d88\u606f\uff0c\u53d7viewModel\u7684Activiy\u3001Fragment\u7684\u751f\u547d\u5468\u671f\u5f71\u54cd\u3002\nviewModel.showMessage(\"Short Message\")\nviewModel.showMessage(\"Long Message\", isShort = false)\n<\/code><\/pre>\n<h2>StateView<\/h2>\n<p><code>StateView<\/code>\u4e3a<strong>\u5305\u542b\u591a\u4e2a\u72b6\u6001\u5f62\u5f0fView<\/strong>\u7684\u63a5\u53e3\uff0c\u72b6\u6001\u5305\u62ec\uff1a<code>Loading<\/code>\u3001<code>Error<\/code>\u3001<code>Empty<\/code>\u3001<code>Success<\/code>\u3002<\/p>\n<h3>\u5b9a\u5236UI<\/h3>\n<p><strong>\u5b9a\u5236UI<\/strong>\uff1a\u76ee\u524d\u5b9e\u73b0<code>StateView<\/code>\u63a5\u53e3\u7684\u7c7b\u662f<code>DefaultStateView<\/code>\u3002<\/p>\n<ul>\n<li><strong>\u5c0f\u6539<\/strong>\uff1a<code>DefaultStateView<\/code>\uff0c<strong>\u9ed8\u8ba4<\/strong>\u5b9e\u73b0\u4e86<code>Loading<\/code>\u3001<code>Error<\/code>\u3001<code>Empty<\/code><strong>\u72b6\u6001<\/strong>\u7684<code>View<\/code>\uff0c\u53ef<strong>\u4fee\u6539\u6307\u5b9a\u67d0\u4e2a<\/strong>\u6765<strong>\u5b9a\u5236UI<\/strong>\u3002<\/li>\n<li><strong>\u5927\u6539<\/strong>\uff1a\u53ef\u901a\u8fc7\u4fee\u6539<code>createAppStateView()<\/code>\u3001<code>createAppListStateView()<\/code>\u65b9\u6cd5\uff0c\u8fd4\u56de<code>StateView<\/code><strong>\u63a5\u53e3\u7684\u5176\u5b83\u5b9e\u73b0\u7c7b<\/strong>\u3002<\/li>\n<\/ul>\n<h3>\u539f\u7406<\/h3>\n<ul>\n<li><strong>\u5217\u8868\u4f7f\u7528<\/strong>\uff1a\u662f\u4f7f\u7528<a href=\"https:\/\/github.com\/CymChad\/BaseRecyclerViewAdapterHelper\">BaseRecyclerViewAdapterHelper<\/a>\u7684<code>stateView<\/code>\u5b9e\u73b0\uff0c\u5e95\u5c42\u539f\u7406\u662f<strong>\u7ed9RecyclerView\u7684Adapter\u6dfb\u52a0\u4e86\u4e00\u6761Item\u5e03\u5c40<\/strong>\u3002<strong>Empty\u72b6\u6001<\/strong>\uff0c\u662f\u901a\u8fc7<strong>\u8fd4\u56de\u7684\u5217\u8868\u6570\u636e\u662f\u5426\u4e3a\u7a7a<\/strong>\u6765\u5224\u65ad\u7684\uff0c\u8be6\u7ec6\u4f7f\u7528\u770b<code>BaseRefreshLoadMoreHelper<\/code>\u3002<\/li>\n<li><strong>\u666e\u901a\u4f7f\u7528<\/strong>\uff1a\u662f\u4f7f\u7528<strong>Base\u7c7b<\/strong><code>Activity<\/code>\u3001<code>Fragment<\/code>\u7684<code>getStateViewReplaceView()<\/code>\u65b9\u6cd5\u5b9e\u73b0\uff0c\u5e95\u5c42\u539f\u7406\u662f<strong>\u7ed9\u6b64\u65b9\u6cd5\u8fd4\u56de\u7684View\u66ff\u6362\u663e\u793a\u4e3aStateView<\/strong>\u3002<strong>Empty\u72b6\u6001<\/strong>\uff0c<strong>\u76ee\u524d\u672a\u5224\u65ad<\/strong>\uff0c\u5982\u9700\u4fee\u6539\u8bf7\u770b<code>BaseViewModel.requestAsyncBase()<\/code>\u6269\u5c55\u65b9\u6cd5\u3002<\/li>\n<\/ul>\n<h3>\u4f7f\u7528<\/h3>\n<ul>\n<li><strong>\u5217\u8868\u4f7f\u7528<\/strong>\uff1a<strong>\u5df2\u5c01\u88c5\u597d<\/strong>\uff0c\u76ee\u524d\u5df2\u652f\u6301<a href=\"https:\/\/github.com\/scwang90\/SmartRefreshLayout\">SmartRefreshLayout<\/a>\u3001<a href=\"https:\/\/developer.android.com\/jetpack\/androidx\/releases\/swiperefreshlayout\">SwipeRefreshLayout<\/a>\u4e24\u4e2a\u63a7\u4ef6\uff0c\u8be6\u7ec6\u4f7f\u7528\u8bf7\u770b<code>SmartRefreshLoadMoreHelper<\/code>\u3001<code>SwipeRefreshLoadMoreHelper<\/code>\u3002<\/li>\n<li><strong>\u666e\u901a\u4f7f\u7528<\/strong>\uff1a\u9700\u8981\u4f7f\u7528<code>BaseViewModel.requestAsyncBase()<\/code>\u6269\u5c55\u65b9\u6cd5<strong>\u5b9a\u5236<\/strong>\u3002\n<ul>\n<li><strong>\u914d\u7f6e<\/strong>\uff1a<code>Activity<\/code>\u3001<code>Fragment<\/code>\u9700\u8981\u5b9e\u73b0<code>getStateViewReplaceView()<\/code>\uff0c\u6b64\u4e3a<code>StateView<\/code>\u8981<strong>\u66ff\u6362\u7684View<\/strong>\uff08\u7528\u4e8e\u5b9e\u73b0<strong>\u66ff\u6362\u663e\u793aStateView<\/strong>\u65f6\uff0c<strong>\u9690\u85cf\u6b64View<\/strong>\uff09\uff0c\u53ef\u901a\u8fc7<strong>\u8986\u5199<\/strong>\u6b64\u65b9\u6cd5\u6765<strong>\u4fee\u6539StateView\u7684\u663e\u793a\u8303\u56f4<\/strong>\uff0c\u5982\u679c\u4e0d\u8986\u5199<strong>\u9ed8\u8ba4<\/strong>\u4e3a\u6b64<code>Activity<\/code>\u3001<code>Fragment<\/code>\u7684<code>root<\/code><strong>\u6839\u5e03\u5c40<\/strong>\u3002\u8be6\u7ec6\u4f7f\u7528\uff0c\u8bf7\u770b<strong>\u901a\u7528\u7ea7<\/strong>\u7684<code>BaseViewsActivity<\/code>\u3001<code>BaseViewsFragment<\/code>\u7b49\u3002<\/li>\n<li><strong>\u4f7f\u7528<\/strong>\uff1a<strong>\u8bf7\u6c42\u5f02\u6b65<\/strong>\u7684<strong>UI<\/strong>\u6bcf\u4eba\u7684\u9700\u6c42\u4e0d\u540c\uff08\u5982\uff1a<code>Error<\/code>\u72b6\u6001\uff0c\u6709\u4eba\u60f3\u8981\u663e\u793a<code>Error<\/code><strong>\u91cd\u8bd5\u5e03\u5c40<\/strong>\uff0c\u6709\u4eba\u60f3\u8981\u53ea\u9700\u8981<strong>\u6d88\u606f\u63d0\u793a<\/strong>\uff09\uff0c<strong>\u5b9a\u5236<\/strong>\u8be6\u7ec6\u4f7f\u7528\uff0c\u8bf7\u770b<code>BaseViewModel.requestAsyncBase()<\/code>\u6269\u5c55\u65b9\u6cd5\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>\u5237\u65b0\u3001\u81ea\u52a8\u52a0\u8f7d<\/h2>\n<h3>\u539f\u7406<\/h3>\n<ul>\n<li><strong>\u5237\u65b0<\/strong>\uff1a\u662f\u4f7f\u7528<a href=\"https:\/\/github.com\/scwang90\/SmartRefreshLayout\">SmartRefreshLayout<\/a>\u6216<a href=\"https:\/\/developer.android.com\/jetpack\/androidx\/releases\/swiperefreshlayout\">SwipeRefreshLayout<\/a>\u5b9e\u73b0\u3002<\/li>\n<li><strong>\u81ea\u52a8\u52a0\u8f7d<\/strong>\uff1a\u662f\u4f7f\u7528<a href=\"https:\/\/github.com\/CymChad\/BaseRecyclerViewAdapterHelper\">BaseRecyclerViewAdapterHelper<\/a>\u7684<code>setTrailingLoadStateAdapter()<\/code>\u5b9e\u73b0\uff0c\u5e95\u5c42\u539f\u7406\u662f<strong>\u901a\u8fc7<\/strong><code>ConcatAdapter.addAdapter(adapter)<\/code><strong>\u589e\u52a0\u4e86\u5c3eAdapter<\/strong>\uff0c\u8be6\u7ec6\u4f7f\u7528\u8bf7\u770b<code>BaseRefreshLoadMoreHelper<\/code>\u3002<\/li>\n<\/ul>\n<h3>\u4f7f\u7528<\/h3>\n<ol>\n<li><strong>UI\u5c42<\/strong>\uff1a<code>Activity<\/code>\u3001<code>Fragment<\/code>\u5b9e\u73b0\u7c7b\uff0c\u9700\u8981\u4f7f\u7528<code>SmartRefreshLoadMoreHelper<\/code>\u6216<code>SwipeRefreshLoadMoreHelper<\/code>\u521d\u59cb\u5316\uff0c\u8be6\u7ec6\u770b<strong>ShopFragment<\/strong>\u3002<\/li>\n<li><strong>ViewModel\u5c42<\/strong>\uff1a<code>ViewModel<\/code>\u5b9e\u73b0\u7c7b\uff0c\u9700\u8981\u5b9e\u73b0<code>RefreshRepositoryOwner<\/code>\u63a5\u53e3\uff0c\u5176<code>onRefreshRepository()<\/code>\u65b9\u6cd5\u9700\u8981\u8fd4\u56de<strong>\u5237\u65b0\/\u5237\u65b0\u52a0\u8f7d<\/strong>\u4ed3\u5e93\u3002<\/li>\n<li><strong>Repository\u5c42<\/strong>\uff1a\n<ol>\n<li><code>Repository<\/code>\u5b9e\u73b0\u7c7b\uff0c\u9700\u8981<strong>\u5b9e\u73b0<\/strong><code>RefreshRepository<\/code>\uff08<strong>\u4ec5\u5237\u65b0<\/strong>\uff09\u6216<code>RefreshLoadMoreRepository<\/code>\uff08<strong>\u5237\u65b0\u52a0\u8f7d<\/strong>\uff09\u63a5\u53e3\u3002<\/li>\n<li><code>Repository<\/code>\u5b9e\u73b0\u7c7b\uff0c\u9700\u8981<strong>\u7ee7\u627f<\/strong><code>PageKeyedMemoryRefreshLoadMoreRepository<\/code>\uff08<strong>\u901a\u8fc7page\u52a0\u8f7d<\/strong>\uff09\u6216<code>ItemKeyedMemoryRefreshLoadMoreRepository<\/code>\uff08<strong>\u901a\u8fc7Item\u52a0\u8f7d<\/strong>\uff09\u7c7b\u3002<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<h2>\u7f51\u7edc<\/h2>\n<p>\u4e00\u4e2a\u516c\u53f8\uff0c\u53ef\u80fd\u6709<strong>\u591a\u4e2a\u7f51\u7edc\u89c4\u5219<\/strong>\uff0c\u53ef\u521b\u5efa\u5b9e\u73b0<code>BaseNetworkModel<\/code>\u63a5\u53e3\u7684<strong>XXXBaseNetworkModel<\/strong>\u7c7b\uff0c\u6765\u5b9e\u73b0<strong>\u6b64\u89c4\u5219\u5b9a\u5236<\/strong>\u529f\u80fd\uff0c\u540e\u7eed\u53ea\u9700\u4f7f\u7528\u6b64\u7c7b\u5373\u53ef\u3002\u76ee\u524d\u9879\u76ee\u5185\u6709<strong>2\u4e2a\u89c4\u5219<\/strong>\u6848\u4f8b\uff0c\u8bf7\u770b<code>ApiOpenBaseNetworkModel<\/code>\u3001<code>AppBaseNetworkModel<\/code>\u7c7b\u3002<\/p>\n<h3>\u5b9a\u4e49XXXBaseNetworkModel<\/h3>\n<p>\u4ee5\u5f00\u6e90\u63a5\u53e3<a href=\"https:\/\/api.apiopen.top\/swagger\/index.html\">ApiOpen<\/a>\u4e3a\u4f8b\uff0c\u5176\u8fd4\u56de\u683c\u5f0f\u6a21\u677f\u4e3a\uff1a<\/p>\n<pre><code class=\"language-json\">{\"code\": 200,  \"message\": \"\u6210\u529f!\",  \"result\": \"string\"}\n<\/code><\/pre>\n<p><code>code<\/code>\u4e3a<strong>200\u4ee3\u8868\u516c\u53f8\u7684\u89c4\u5219\u6210\u529f<\/strong>\uff0c<code>message<\/code>\u4e3a<strong>\u63d0\u793a\u7684\u6d88\u606f<\/strong>\uff0c<code>result<\/code>\u4e3a<strong>\u7ed3\u679c\uff08\u7c7b\u578b\u4efb\u610f\uff09<\/strong>\uff0c\u4ee5\u6b64\u521b\u5efa\u7c7b\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"language-kotlin\">@Serializable\ndata class ApiOpenBaseNetworkModel&lt;T&gt;(val code: Int, val message: String, val result: T? = null) :\n    BaseNetworkModel&lt;T&gt; {\n    override fun isRuleSuccess() = code == 200\n\n    override fun code() = code\n    override fun message() = message\n    override fun data() = result\n}\n<\/code><\/pre>\n<h3>\u4f7f\u7528XXXBaseNetworkModel<\/h3>\n<pre><code class=\"language-kotlin\">interface FakeNetworkLoginApi {\n    \/**\n     * \u767b\u5f55\n     *\/\n    @POST(\"api\/login\")\n    @FormUrlEncoded\n    suspend fun login(\n        @Field(\"account\") account: String,\n        @Field(\"password\") password: String,\n    ): ApiOpenBaseNetworkModel&lt;FakeNetworkUser&gt;\n}\n<\/code><\/pre>\n<p><code>login()<\/code>\u65b9\u6cd5\uff0c\u5176\u8fd4\u56de\u503c\u4e3a<code>ApiOpenBaseNetworkModel<\/code>\uff0c\u5176<strong>\u6cdb\u578b\u4e3ajson\u6a21\u677f\u7684result\u503c<\/strong>\u3002\u8c03\u7528\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"language-kotlin\">loginApi.login(account, password)\n<\/code><\/pre>\n<p><code>loginApi.login()<\/code>\u65b9\u6cd5\uff0c\u5176\u8fd4\u56de\u503c\u4e3a<code>ApiOpenBaseNetworkModel<\/code>\uff0c\u8fd9\u4e2a\u6570\u636e\u4e0d\u4ec5\u5305\u542b\u4e86<strong>json\u6a21\u5757\u7684\u5168\u90e8\u4fe1\u606f<\/strong>\uff0c\u800c\u4e14\u6211\u4eec\u8fd8\u5f97\u9700\u8981\u5224\u65ad\u5176<strong>\u662f\u5426\u516c\u53f8\u89c4\u5219\u6210\u529f<\/strong>\u3002<\/p>\n<p>\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b<strong>\u8f6c\u6362\u65b9\u6cd5<\/strong>\uff0c\u8f6c\u4e3a\u81ea\u5df1\u60f3\u8981\u7684\u7ed3\u679c\u3002<\/p>\n<h3>\u8f6c\u6362XXXBaseNetworkModel<\/h3>\n<pre><code class=\"language-kotlin\">loginApi.login(account, password).toRuleSuccessData()\n<\/code><\/pre>\n<p><code>toRuleSuccessData()<\/code>\u65b9\u6cd5\uff0c\u5c06<code>ApiOpenBaseNetworkModel<\/code>\uff0c\u8f6c\u6362\u4e3a<strong>\u516c\u53f8\u89c4\u5219\u6210\u529f<\/strong>\uff0c\u5e76\u4e14<strong>\u8fd4\u56de\u5176\u5185\u90e8\u7684result<\/strong>\uff0c\u5e76\u4e14<strong>\u6b64\u8fd4\u56de\u503c\u4e0d\u4e3a\u7a7a<\/strong>\u3002<\/p>\n<p><strong>\u76ee\u524d\u652f\u6301\u7684\uff0c\u6240\u6709\u8f6c\u6362\u65b9\u6cd5\uff0c\u5982\u4e0b\uff1a<\/strong><\/p>\n<pre><code class=\"language-kotlin\">\/**\n * \u7f51\u7edc\u6210\u529f-\u89c4\u5219\u6210\u529f-\u5185\u90e8\u6570\u636e-\u4e0d\u53ef\u7a7a\n *\/\nfun &lt;T&gt; BaseNetworkModel&lt;T&gt;.toRuleSuccessData(): T {\n    if (!isRuleSuccess()) {\n        throw RuleException(code(), message())\n    }\n    return data()!!\n}\n\n\/**\n * \u7f51\u7edc\u6210\u529f-\u89c4\u5219\u6210\u529f-\u5185\u90e8\u6570\u636e-\u53ef\u7a7a\n *\/\nfun &lt;T&gt; BaseNetworkModel&lt;T&gt;.toRuleSuccessDataNullable(): T? {\n    if (!isRuleSuccess()) {\n        throw RuleException(code(), message())\n    }\n    return data()\n}\n\n\/**\n * \u7f51\u7edc\u6210\u529f-\u89c4\u5219\u6210\u529f-\u5168\u90e8\u6570\u636e\n *\/\nfun &lt;T&gt; BaseNetworkModel&lt;T&gt;.toRuleSuccess(): BaseNetworkModel&lt;T&gt; {\n    if (!isRuleSuccess()) {\n        throw RuleException(code(), message())\n    }\n    return this\n}\n\/\/ \u7f51\u7edc\u6210\u529f-\u5168\u90e8\u6570\u636e\u3002\u5219\u4e0d\u9700\u8981\u8c03\u7528\u6b64\u8f6c\u6362\u65b9\u6cd5\uff0c\u76f4\u63a5\u8fd4\u56de\u5373\u53ef\u3002\n<\/code><\/pre>\n<p>\u53ef\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\uff0c\u4f7f\u7528\u81ea\u5df1\u60f3\u8981\u7684\u8f6c\u6362\u65b9\u6cd5\uff0c\u4e00\u822c\u4e3a<code>toRuleSuccessData()<\/code>\uff08<strong>\u7f51\u7edc\u6210\u529f-\u89c4\u5219\u6210\u529f-\u5185\u90e8\u6570\u636e-\u4e0d\u53ef\u7a7a<\/strong>\uff09\u3002<\/p>\n<h1>\u672a\u6765\u652f\u6301<\/h1>\n<ul>\n<li>\u652f\u6301<strong>Compose<\/strong><\/li>\n<li>\u4f18\u5316<strong>\u662f\u5426Login<\/strong>\u76f8\u5173\u903b\u8f91<\/li>\n<li>\u4f18\u5316<strong>WebView<\/strong>\u76f8\u5173\u903b\u8f91<\/li>\n<\/ul>\n<h1>\u5176\u5b83<\/h1>\n<h2>\u4e09\u65b9\u5e93<\/h2>\n<h3>\u81ea\u5df1<\/h3>\n<ul>\n<li><a href=\"https:\/\/github.com\/zrq1060\/TestPoint\">TestPoint<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/zrq1060\/SpanBuilder\">SpanBuilder<\/a><\/li>\n<\/ul>\n<h3>\u4e09\u65b9<\/h3>\n<ul>\n<li><a href=\"https:\/\/github.com\/square\/retrofit\">Retrofit<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/bumptech\/glide\">Glide<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/CymChad\/BaseRecyclerViewAdapterHelper\">BaseRecyclerViewAdapterHelper<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/scwang90\/SmartRefreshLayout\">SmartRefreshLayout<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/hackware1993\/MagicIndicator\">MagicIndicator<\/a><\/li>\n<\/ul>\n<h2>\u53c2\u8003<\/h2>\n<ul>\n<li><a href=\"https:\/\/github.com\/android\/nowinandroid\">nowinandroid<\/a>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/android\/architecture-samples\">architecture-samples<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>\u9879\u76ee\u94fe\u63a5\uff1a<\/strong> <a href=\"https:\/\/github.com\/zrq1060\/architecture-android\">architecture-android<\/a>\uff0c<strong>\u6b22\u8fce\u5927\u5bb6\u70b9\u8d5e\u3001\u6536\u85cf\uff0c\u4ee5\u65b9\u4fbf\u60a8\u540e\u7eed\u67e5\u770b\u3002<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Architecture-Android \u529f\u80fd\u4ecb\u7ecd \u652f\u6301\u914d\u7f6e\u53d8\u66f4\u540e\u7684\u8fd8\u539f \u5c4f\u5e55\u65cb\u8f6c \u4eae\u6697\u4e3b\u9898\u5207\u6362 \u8bed\u8a00\u5207\u6362\uff08\u56fd [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[31],"class_list":["post-245","post","type-post","status-publish","format-standard","hentry","category-other","tag-android"],"modified_by":"admin","jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/www.devblog.cn\/index.php?rest_route=\/wp\/v2\/posts\/245","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.devblog.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.devblog.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.devblog.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.devblog.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=245"}],"version-history":[{"count":57,"href":"http:\/\/www.devblog.cn\/index.php?rest_route=\/wp\/v2\/posts\/245\/revisions"}],"predecessor-version":[{"id":305,"href":"http:\/\/www.devblog.cn\/index.php?rest_route=\/wp\/v2\/posts\/245\/revisions\/305"}],"wp:attachment":[{"href":"http:\/\/www.devblog.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=245"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.devblog.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=245"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.devblog.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}