{"id":389887,"date":"2024-06-29T08:53:30","date_gmt":"2024-06-29T08:53:30","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=389887"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-06-29T08:53:30","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=389887","title":{"rendered":"<span>\u041c\u043d\u043e\u0433\u043e\u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432 Android \u0438 Dagger: \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<blockquote>\n<p>\u041d\u0430\u0448\u0435 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0435 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 <a href=\"https:\/\/habr.com\/ru\/users\/mobileSimbirSoft\/posts\/\"><u>\u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442<\/u><\/a> \u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u043e\u043f\u044b\u0442\u043e\u043c, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u0435 \u0441\u0442\u0430\u0442\u044c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0441\u043e\u0441\u043b\u0443\u0436\u0438\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u0445\u043e\u0440\u043e\u0448\u0443\u044e \u0441\u043b\u0443\u0436\u0431\u0443. <a href=\"https:\/\/proandroiddev.com\/android-multi-module-dagger-a-real-use-case-step-by-step-bbc03500f2f9\">\u042d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e<\/a> \u043f\u043e Android, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e \u0432 2020 \u0433\u043e\u0434\u0443, \u043c\u044b \u0432\u044b\u0431\u0440\u0430\u043b\u0438, \u0438\u0437\u0443\u0447\u0430\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0438 \u043f\u0435\u0440\u0435\u0432\u0435\u043b\u0438 \u0441 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0430\u0432\u0442\u043e\u0440\u0430. \u0421 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043e\u043d \u043e\u0441\u0432\u0435\u0449\u0430\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0438\u0435 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 Dagger \u0432 \u043c\u043d\u043e\u0433\u043e\u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0438 \u0434\u0430\u0435\u0442 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0438\u0445 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c, \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0432 \u043f\u0440\u0438\u00a0 \u044d\u0442\u043e\u043c \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0435 \u043f\u043e\u0433\u0440\u0443\u0436\u0430\u0442\u044c\u0441\u044f \u0432 \u0442\u0435\u043c\u0443 \u043c\u043d\u043e\u0433\u043e\u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 Dagger, \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0440\u044f\u0434\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0440\u0435\u0448\u0438\u0442\u044c \u0442\u0435, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0432\u044b \u0443\u0436\u0435 \u043c\u043e\u0433\u043b\u0438 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0441 \u043e\u043f\u044b\u0442\u043e\u043c \u0442\u043e\u0436\u0435, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u043d\u0430\u0439\u0434\u0443\u0442 \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u043e\u0432\u0435\u0442\u044b \u0438\u043b\u0438 \u0436\u0435 \u0438\u0434\u0435\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u0441\u043a\u0430\u0436\u0443\u0442 \u043d\u043e\u0432\u044b\u0435 \u043f\u0443\u0442\u0438 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438 \u0432 \u043c\u043d\u043e\u0433\u043e\u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435. <\/p>\n<\/blockquote>\n<p><strong>\u041e\u0442 \u0430\u0432\u0442\u043e\u0440\u0430:<\/strong> \u043f\u0440\u0435\u0436\u0434\u0435, \u0447\u0435\u043c \u043c\u044b \u043d\u0430\u0447\u043d\u0435\u043c, \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u0434\u043b\u0438\u043d\u043d\u043e\u0439. \u0412\u043c\u0435\u0441\u0442\u0435 \u043c\u044b \u0448\u0430\u0433 \u0437\u0430 \u0448\u0430\u0433\u043e\u043c \u043d\u0430\u0439\u0434\u0435\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0443. \u0426\u0435\u043b\u044c\u044e \u0431\u044b\u043b\u043e \u043f\u043e\u044d\u0442\u0430\u043f\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Dagger \u0432\u043d\u0435\u0434\u0440\u044f\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u043c\u043d\u043e\u0433\u043e\u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0448\u0430\u0433\u0430 \u0431\u0443\u0434\u0435\u0442 \u0434\u0430\u043d\u0430 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043a\u043e\u043c\u043c\u0438\u0442, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u0434\u0435\u043b\u0430\u043d\u044b \u044d\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u043a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043f\u043e\u043a\u0430\u0436\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u0434\u0430.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u0435\u043c \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0445\u043e\u0442\u044f \u0431\u044b \u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0437\u043d\u0430\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>kotlin<\/p>\n<\/li>\n<li>\n<p>\u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 component \u0432 dagger<\/p>\n<\/li>\n<li>\n<p>\u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 module \u0432 dagger<\/p>\n<\/li>\n<li>\n<p>\u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 scope \u0432 dagger<\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u043e \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 Kotlin \u043c\u044b \u043f\u0438\u0441\u0430\u043b\u0438 <\/em><a href=\"https:\/\/habr.com\/ru\/company\/simbirsoft\/blog\/546452\/\"><em><u>\u0437\u0434\u0435\u0441\u044c<\/u><\/em><\/a><em>, \u0430 \u043f\u043e Dagger \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c \u0441\u0435\u0440\u0438\u044e \u0441\u0442\u0430\u0442\u0435\u0439 \u2013 \u0447\u0430\u0441\u0442\u0438 <\/em><a href=\"https:\/\/habr.com\/ru\/post\/279125\/\"><em><u>1<\/u><\/em><\/a><em>, <\/em><a href=\"https:\/\/habr.com\/ru\/post\/279641\/\"><em><u>2<\/u><\/em><\/a><em>, <\/em><a href=\"https:\/\/habr.com\/ru\/post\/320676\/\"><em><u>3<\/u><\/em><\/a><em>.\u00a0<\/em><\/p>\n<\/blockquote>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/developer.android.com\/training\/dependency-injection\/dagger-multi-module#best-practices\"><u>\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u044f\u043c Google \u043f\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e Dagger<\/u><\/a> (\u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0446\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043d\u0438\u0436\u0435). \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043b\u0435\u043d\u044c \u0447\u0438\u0442\u0430\u0442\u044c, \u043c\u043e\u0436\u043d\u043e \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/github.com\/JulianEzequiel\/dagger-multi-module\"><u>\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 GitHub<\/u><\/a>, \u043e\u0434\u043d\u0430\u043a\u043e, \u043d\u0435 \u0443\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0441\u0430\u043c\u043e\u0435 \u0432\u0430\u0436\u043d\u043e\u0435.<\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439!<\/p>\n<ul>\n<li>\n<p>\u041e \u043c\u043e\u0434\u0443\u043b\u044f\u0445 Dagger \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c <code>Module<\/code>, \u0430 \u043e \u043c\u043e\u0434\u0443\u043b\u044f\u0445 Android \u2013 \u043f\u0440\u043e\u0441\u0442\u043e \u00ab\u043c\u043e\u0434\u0443\u043b\u0438\u00bb (\u0431\u0435\u0437 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f).\u00a0<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435 <code>\u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435<\/code>, \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u043a\u043b\u0430\u0441\u0441\u0430\u0445 Dagger.<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0442\u0430\u043a, \u043d\u0430\u0447\u043d\u0435\u043c!<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4ca\/568\/394\/4ca5683947359f67010ab0da8b219e12.png\" width=\"780\" height=\"440\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4ca\/568\/394\/4ca5683947359f67010ab0da8b219e12.png\"\/><\/figure>\n<h3>\u041f\u0440\u043e\u0435\u043a\u0442<\/h3>\n<p>\u041c\u044b \u0445\u043e\u0442\u0438\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f, \u0433\u0440\u0430\u0444\u0438\u043a\u0438, \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0444\u043e\u0440\u043c\u0443\u043b \u0438 \u0442.\u0434.<\/p>\n<p>\u041d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0441\u0443\u043c\u043c\u044b, \u0438 \u044d\u0442\u043e \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0441\u043e\u0432\u0441\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u043c, \u043d\u0435 \u0442\u0430\u043a \u043b\u0438?<\/p>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u043b\u044e\u0431\u0438\u043c \u0445\u0430\u0439\u043f \u0438 \u0445\u043e\u0442\u0438\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u043c. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0434\u0432\u0430 \u043c\u043e\u0434\u0443\u043b\u044f:<\/p>\n<ul>\n<li>\n<p><em>\u041c\u043e\u0434\u0443\u043b\u044c App<\/em> \u2013 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u0438.<\/p>\n<\/li>\n<li>\n<p><em>\u041c\u043e\u0434\u0443\u043b\u044c Calculator<\/em>, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f (\u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0443\u043c\u043c\u0430).<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0435\u0445\u0430\u043b\u0438 \u0434\u0430\u043b\u044c\u0448\u0435!<\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u044f Calculator<\/h3>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c <em>App<\/em> \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 Android Studio.\u00a0<\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c <em>Calculator<\/em> \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u0443\u043c\u043c\u044b. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u0434\u0432\u0430 \u0447\u0438\u0441\u043b\u0430 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438\u0445 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u043d\u0430\u0447\u043d\u0435\u043c:<\/p>\n<ul>\n<li>\n<p>\u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c <em>Activity<\/em> \u0434\u043b\u044f \u0432\u0432\u043e\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/li>\n<li>\n<p>\u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c <em>Use Case<\/em>, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 \u0447\u0438\u0441\u0435\u043b.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u044f\u0441\u043d\u044e, \u0447\u0442\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043b\u043e\u0435\u0432, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0448\u0438\u0441\u044c <em>Activity<\/em> \u0441 \u043e\u0434\u043d\u0438\u043c <em>Use Case<\/em>. \u041f\u043e\u0437\u0436\u0435 \u043c\u044b \u0443\u0431\u0435\u0434\u0438\u043c\u0441\u044f, \u0447\u0442\u043e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u043d\u0435 \u0442\u0430\u043a \u0432\u0430\u0436\u0435\u043d, \u043a\u0430\u043a \u0447\u0435\u0442\u043a\u043e\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0440\u0435\u0448\u0438\u0442\u044c.<\/p>\n<p><em>Use Case<\/em> \u0438 <em>Activity<\/em> \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"kotlin\">lateinit var sumUseCase: SumUseCase  override fun onCreate(savedInstanceState: Bundle?) {     super.onCreate(savedInstanceState)      sumUseCase = SumUseCase() }<\/code><\/pre>\n<p><em>CalculatorActivity (calculator module)<\/em><\/p>\n<pre><code class=\"kotlin\">class SumUseCase {      fun execute(firstNumber: Int, secondNumber: Int): Int {         return firstNumber + secondNumber     }  }<\/code><\/pre>\n<p><em>SumUseCase (calculator module)<\/em><\/p>\n<p>\u0412 \u043a\u043e\u0434\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u043a\u043e\u0435-\u0447\u0442\u043e, <strong>\u043d\u0435<\/strong> \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435:<\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 UI \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0432\u0432\u043e\u0434\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u043a\u043e\u0434 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043c\u0435\u0436\u0434\u0443 <em>Activity<\/em> \u0438 <em>Use Case<\/em>.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u043c\u043e\u0434\u0443\u043b\u044c <em>Calculator<\/em> \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u043e\u0434\u0443\u043b\u044f <em>App<\/em>, \u0447\u0442\u043e\u0431\u044b \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>Activity<\/em> \u0438\u0437 <em>MainActivity<\/em> (\u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u044d\u0442\u043e \u043f\u043e\u0437\u0436\u0435).<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0430 \u043d\u0430 <em>MainActivity<\/em>, \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0441\u044f <em>CalculatorActivity<\/em> (\u043f\u043e\u0437\u0436\u0435 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0438 \u044d\u0442\u043e).<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u0438 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u0434\u0430 \u043d\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u0441\u0442\u0430\u0442\u044c\u0435. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0432\u044b \u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c <em>Activity<\/em>, <em>OnClickListener<\/em> \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c <em>Activity<\/em>.<\/p>\n<blockquote>\n<p><em>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 <\/em><a href=\"https:\/\/github.com\/JulianEzequiel\/dagger-multi-module\/commit\/e6f8b765602e548e71fe4ac257c729b7c7f9a8eb\"><em><u>\u044d\u0442\u043e\u043c \u043a\u043e\u043c\u043c\u0438\u0442\u0435<\/u><\/em><\/a><\/p>\n<\/blockquote>\n<h3>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 Dagger2 \u0432 \u043c\u043e\u0434\u0443\u043b\u044c Calculator<\/h3>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438:<\/p>\n<pre><code class=\"kotlin\">apply plugin: 'kotlin-kapt'  ...  dependencies {   ...      api \"com.google.dagger:dagger:${dagger.version}\" \/\/I'm using 2.27   kapt \"com.google.dagger:dagger-compiler:${dagger.version}\" \/\/I'm using 2.27 }<\/code><\/pre>\n<p><em>build.gradle (calculator module)<\/em><\/p>\n<blockquote>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044e. Google \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442:<\/p>\n<p><em>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b Dagger \u0432 \u043c\u043e\u0434\u0443\u043b\u044f\u0445, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u043f\u043e\u043b\u044f \u0432 \u044d\u0442\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u0435 \u0438\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0436\u0438\u0437\u043d\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u043c \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/em><\/p>\n<\/blockquote>\n<p>\u0418\u0442\u0430\u043a, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f <em>Activity<\/em> \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u0438 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f <code>Component<\/code> \u0434\u043b\u044f \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0432 \u043d\u0435\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c <code>Component<\/code> \u0438 <code>Module<\/code>:<\/p>\n<pre><code class=\"kotlin\">@Singleton @Component(modules = [CalculatorModule::class]) interface CalculatorComponent {      fun inject(calculatorActivity: CalculatorActivity)  }<\/code><\/pre>\n<p><em>CalculatorComponent (calculator module)<\/em><\/p>\n<pre><code class=\"kotlin\">@Module class CalculatorModule {      @Provides     @Singleton     fun sumUseCase(): SumUseCase = SumUseCase()  }<\/code><\/pre>\n<p><em>CalculatorModule (calculator module)<\/em><\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c Dagger \u0434\u043b\u044f \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f <em>UseCase<\/em> \u0432 <em>Activity<\/em>:<\/p>\n<pre><code class=\"kotlin\">class CalculatorActivity : AppCompatActivity() {     @Inject lateinit var sumUseCase: SumUseCase      ...      override fun onCreate(savedInstanceState: Bundle?) {         super.onCreate(savedInstanceState)                  ...         DaggerCalculatorComponent.builder().build()             .inject(this)         ...    }      ... }<\/code><\/pre>\n<p><em>CalculatorActivity (calculator module)<\/em><\/p>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0435! \u041c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 Dagger \u0432 \u043c\u043e\u0434\u0443\u043b\u044c <em>Calculator<\/em>, \u0447\u0442\u043e\u0431\u044b \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c \u043d\u0430\u0448\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<blockquote>\n<p><em>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 <\/em><a href=\"https:\/\/github.com\/JulianEzequiel\/dagger-multi-module\/commit\/e6f8b765602e548e71fe4ac257c729b7c7f9a8eb\"><em><u>\u044d\u0442\u043e\u043c <\/u><\/em><\/a><a href=\"https:\/\/github.com\/JulianEzequiel\/dagger-multi-module\/commit\/2cbd2273cfdfbac8a8dfb1094b9b860def115ea0\"><em><u>\u043a\u043e\u043c\u043c\u0438\u0442\u0435<\/u><\/em><\/a><\/p>\n<\/blockquote>\n<h3>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Use Case<\/h3>\n<p>\u0412 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u0445 \u043a <em>Use Case<\/em> \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, \u0447\u0442\u043e \u0434\u043b\u044f \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u0447\u0438\u0441\u0435\u043b \u043e\u0431\u0430 \u0438\u0437 \u043d\u0438\u0445 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438, \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0443\u043b\u044f. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435.<\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 (\u0443\u0441\u043f\u0435\u0448\u043d\u043e\/\u043e\u0448\u0438\u0431\u043a\u0430) \u0432 <em>Use Case<\/em> \u044f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>Sealed Class<\/code> (\u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0443\u0433\u043b\u0443\u0431\u043b\u044f\u0442\u044c\u0441\u044f, \u0442.\u043a. \u044d\u0442\u043e \u043d\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u0442\u0430\u0442\u044c\u0438). \u0422\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"kotlin\">class SumUseCase {      fun execute(firstNumber: Int, secondNumber: Int): Result {         return if (firstNumber > 0 &amp;&amp; secondNumber > 0) {             Result.Success(firstNumber + secondNumber)         } else {             Result.Failure(\"Both numbers must be greater than 0!!\")         }     }      sealed class Result {         class Success(val result: Int) : Result()         class Failure(val message: String) : Result()     }  }<\/code><\/pre>\n<p><em>SumUseCase (calculator module)<\/em><\/p>\n<p>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0432 <em>Activity<\/em>:<\/p>\n<ul>\n<li>\n<p><strong>\u0423\u0441\u043f\u0435\u0448\u043d\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 (Result.Success) <\/strong>\u2013 \u043f\u043e\u043a\u0430\u0436\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0441\u0443\u043c\u043c\u0443 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b.<\/p>\n<\/li>\n<li>\n<p><strong>\u041e\u0448\u0438\u0431\u043a\u0430 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 (Result.Failure) <\/strong>\u2013 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u0432\u0438\u0434\u0438\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 (\u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0435\u0451 \u0432 \u043a\u043e\u0434\u0435). <\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p><em>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 <\/em><a href=\"https:\/\/github.com\/JulianEzequiel\/dagger-multi-module\/commit\/07c450f6608cd66f26d8bcabd4142542a1f4b554\"><em><u>\u044d\u0442\u043e\u043c \u043a\u043e\u043c\u043c\u0438\u0442\u0435<\/u><\/em><\/a><\/p>\n<\/blockquote>\n<h2>\u0417\u0430\u0445\u0430\u0440\u0434\u043a\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u2013 \u044d\u0442\u043e \u043d\u0435 \u0435\u0441\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u043e<\/h2>\n<p>\u0423 \u043d\u0430\u0441 \u043f\u0435\u0440\u0432\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430! \u0421\u0442\u0440\u043e\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043e\u0448\u0438\u0431\u043a\u0443 \u043f\u0440\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u0437\u0430\u0445\u0430\u0440\u0434\u043a\u043e\u0436\u0435\u043d\u0430, \u043d\u043e \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430 \u0438 \u0447\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c \u0432 <em>strings.xml<\/em>.<\/p>\n<p>\u0414\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0441\u0442\u0440\u043e\u043a\u0430\u043c \u0438\u0437 <em>strings.xml<\/em> \u043d\u0443\u0436\u0435\u043d <em>Context<\/em>, \u043d\u043e \u0443 <em>Use Case<\/em> \u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a <em>Context<\/em>.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u044f \u0441\u043e\u0437\u0434\u0430\u044e <em>StringsProvider<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u043e \u0435\u0435 id:<\/p>\n<pre><code class=\"kotlin\">class StringsProvider(     val application: Application ) {      fun getString(@StringRes id: Int): String = application.getString(id)  }<\/code><\/pre>\n<p><em>StringsProvider (calculator module)<\/em><\/p>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <em>Application<\/em>, \u0430 \u043d\u0435 <em>Context<\/em>? \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u0430\u043a\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u044f \u043c\u043e\u0433\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>StringsProvider<\/em> \u043a\u0430\u043a Singleton, \u0438 \u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 <em>Activity<\/em> \u0438\u043b\u0438 <em>Fragment<\/em>.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c <em>StringsProvider<\/em> \u0432 <em>Use Case<\/em>:<\/p>\n<pre><code class=\"kotlin\">class SumUseCase(     val stringsProvider: StringsProvider ) {      fun execute(firstNumber: Int, secondNumber: Int): Result {         ...             Result.Failure(stringsProvider.getString(R.string.both_numbers_must_be_positive))         ...     }          ... }<\/code><\/pre>\n<p><em>SumUseCase (calculator module)<\/em><\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c <code>Module<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 <em>Use Case<\/em>. \u0411\u0435\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c! \u0421 Dagger \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<ul>\n<li>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0434\u043b\u044f <em>CalculatorModule<\/em>, \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043d\u0435\u0434\u0440\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442 <em>Application<\/em>.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0442\u0435\u043c \u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e \u0432 <code>Module<\/code> \u0434\u0432\u0430 <em>Provides-\u043c<\/em>\u0435\u0442\u043e\u0434\u0430, \u043e\u0434\u0438\u043d \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <em>Application<\/em>, \u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u2013 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0438\u0442\u044c <em>StringsProvider<\/em>.<\/p>\n<\/li>\n<li>\n<p>\u042f \u043c\u0435\u043d\u044f\u044e \u043c\u0435\u0442\u043e\u0434, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <em>SumUseCase<\/em>, \u0442.\u043a. \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043d \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 <em>StringProvider<\/em>.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f <em>CalculatorComponent<\/em>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c Dagger, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c <em>CalculatorModule<\/em>.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"kotlin\">@Module class CalculatorModule(     val application: Application ) {      @Provides     @Singleton     fun application(): Application = application      @Provides     @Singleton     fun stringsProvider(         application: Application     ): StringsProvider = StringsProvider(application)      @Provides     @Singleton     fun sumUseCase(         stringsProvider: StringsProvider     ): SumUseCase = SumUseCase(stringsProvider)  }<\/code><\/pre>\n<p><em>CalculatorModule (calculator module)<\/em><\/p>\n<pre><code class=\"kotlin\">class CalculatorActivity : AppCompatActivity() {   ...       override fun onCreate(savedInstanceState: Bundle?) {     ...          DaggerCalculatorComponent.builder()             .calculatorModule(CalculatorModule(application))             .build()             .inject(this)          ...   }      ... }<\/code><\/pre>\n<p><em>CalculatorActivity (calculator module)<\/em><\/p>\n<blockquote>\n<p><em>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 <\/em><a href=\"https:\/\/github.com\/JulianEzequiel\/dagger-multi-module\/commit\/4333aeae118b3edd05eda65b7f749a789943618f\"><em><u>\u044d\u0442\u043e\u043c \u043a\u043e\u043c\u043c\u0438\u0442\u0435<\/u><\/em><\/a><\/p>\n<\/blockquote>\n<h2>\u041f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435 CoreModule?<\/h2>\n<p><em>StringsProvider<\/em> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0438 \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u0430 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f <em>Calculator<\/em>. \u0427\u0430\u0441\u0442\u043e \u0438 \u043c\u043d\u043e\u0433\u043e \u0433\u0434\u0435 \u0431\u044b\u0432\u0430\u0435\u0442 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443, \u0432\u0435\u0440\u043d\u043e?<\/p>\n<p>\u0418\u0442\u0430\u043a, \u043c\u043e\u0436\u0435\u043c \u043b\u0438 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c <em>CoreModule<\/em> \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \u043d\u0435\u0433\u043e <em>StringsProvider<\/em>? \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u0438\u0437\u0431\u0435\u0433\u0430\u0435\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e <em>StringsProvider<\/em>, \u0440\u0435\u0448\u0430\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c:<\/p>\n<ul>\n<li>\n<p>\u041d\u0435 \u0431\u0443\u0434\u0435\u0442 Module \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 <em>StringsProvider<\/em>.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0441\u0442\u0443\u043f \u043a <em>strings.xml<\/em> \u0431\u0443\u0434\u0435\u0442 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u043c. \u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 <em>StringsProvider<\/em> \u0432\u043e \u0432\u0441\u0435\u0445 \u0447\u0430\u0441\u0442\u044f\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043c\u044b \u0440\u0435\u0448\u0438\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0441 <em>Context<\/em>-\u043e\u043c (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u0435 <em>Activities<\/em> \u0438 <em>Fragments<\/em>).<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c <em>CoreModule<\/em> \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u043c \u0442\u0443\u0434\u0430 <em>StringsProvider<\/em> (\u0442\u0430\u043a \u043c\u044b \u0443\u0434\u0430\u043b\u0438\u043c \u0435\u0433\u043e \u0438\u0437 \u043c\u043e\u0434\u0443\u043b\u044f <em>Calculator<\/em>).<\/p>\n<p>\u042d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u043e\u0432\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443: \u043c\u043e\u0434\u0443\u043b\u044c <em>Calculator<\/em> \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 <em>StringsProvider<\/em>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 Dagger \u0432\u044b\u0434\u0430\u0441\u0442 \u043e\u0448\u0438\u0431\u043a\u0443 \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442.<\/p>\n<blockquote>\n<p>\u041a\u0430\u043a \u043c\u044b \u0440\u0435\u0448\u0430\u0435\u043c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443? \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u044f\u043c\u0438 Google:<\/p>\n<p><em>\u0414\u043b\u044f \u043c\u043e\u0434\u0443\u043b\u0435\u0439 Gradle, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0443\u0442\u0438\u043b\u0438\u0442 \u0438\u043b\u0438 \u0445\u044d\u043b\u043f\u0435\u0440\u043e\u0432 \u0438 \u043d\u0435 \u043d\u0443\u0436\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u0433\u0440\u0430\u0444\u0430 (\u0432\u043e\u0442 \u043f\u043e\u0447\u0435\u043c\u0443 \u0432\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 Dagger), \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u043e\u0431\u0449\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 Dagger \u0441 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438, \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f\u043c\u0438 @Provides \u0438 @Bind, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u043c\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435 \u0432\u043d\u0435\u0434\u0440\u044f\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440.<\/em><\/p>\n<\/blockquote>\n<p>\u0418\u0442\u0430\u043a, \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e <em>CoreModule<\/em>, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u043c <em>StringsProvider<\/em>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u043c <code>Module<\/code>, \u0430 \u043d\u0435 <code>Component<\/code>.<\/p>\n<pre><code class=\"kotlin\">@Module class CoreModule(     val application: Application ) {      @Provides     @Singleton     fun stringsProvider() = StringsProvider(application)  }<\/code><\/pre>\n<p><em>CoreModule (core module)<\/em><\/p>\n<blockquote>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: <\/strong>\u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 Dagger <em>CoreModule<\/em>, \u043a\u0430\u043a \u043c\u044b \u0440\u0430\u043d\u0435\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u044d\u0442\u043e \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438.<\/p>\n<\/blockquote>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c <em>StringsProvider<\/em>, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>CoreModule<\/em> \u0432\u043d\u0443\u0442\u0440\u0438 <em>CalculatorComponent<\/em>. \u0418\u0442\u0430\u043a, \u0434\u0435\u043b\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ul>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043c\u043e\u0434\u0443\u043b\u044c <em>Calculator <\/em>\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0442<em> CoreModule<\/em>.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c <em>CoreModule<\/em> \u0432 <em>CalculatorComponent<\/em>.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437\u043c\u0435\u043d\u044f\u0435\u043c <em>CalculatorModule<\/em>, \u0447\u0442\u043e\u0431\u044b \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 <em>CoreModule<\/em>.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437\u043c\u0435\u043d\u044f\u0435\u043c \u0431\u0438\u043b\u0434\u0435\u0440 <em>DaggerCalculatorComponent<\/em>.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"kotlin\">@Module class CalculatorModule {      @Provides     @Singleton     fun sumUseCase(         stringsProvider: StringsProvider     ): SumUseCase = SumUseCase(stringsProvider)  }<\/code><\/pre>\n<p><em>CalculatorModule (calculator module)<\/em><\/p>\n<pre><code class=\"kotlin\">@Singleton @Component(     modules = [         CalculatorModule::class,         CoreModule::class     ] ) interface CalculatorComponent {      fun inject(calculatorActivity: CalculatorActivity)  }<\/code><\/pre>\n<p><em>CalculatorComponent (calculator module)<\/em><\/p>\n<pre><code class=\"kotlin\">class CalculatorActivity : AppCompatActivity() {   ...        override fun onCreate(savedInstanceState: Bundle?) {       ...       DaggerCalculatorComponent.builder()           .coreModule(CoreModule(application))           .build()           .inject(this)       ...   }      ... }<\/code><\/pre>\n<p><em>CalculatorActivity (calculator module)<\/em><\/p>\n<p>\u041f\u0440\u0435\u0432\u043e\u0441\u0445\u043e\u0434\u043d\u043e! \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Dagger.<\/p>\n<blockquote>\n<p><em>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 <\/em><a href=\"https:\/\/github.com\/JulianEzequiel\/dagger-multi-module\/commit\/68f3c8c727f0c1e5a70c984c0ba7a4737410be08\"><em><u>\u044d\u0442\u043e\u043c \u043a\u043e\u043c\u043c\u0438\u0442\u0435<\/u><\/em><\/a><\/p>\n<\/blockquote>\n<h2>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435: \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439<\/h2>\n<blockquote>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435 \u043e\u0442 \u0430\u0432\u0442\u043e\u0440\u0430:<\/strong> \u0432 \u043a\u043e\u0434\u0435 \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u0430 \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0430 \u0432 \u0441\u043b\u043e\u0432\u0435 Subscriptions (\u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e Suscriptions), \u043f\u0440\u0438\u043d\u043e\u0448\u0443 \u0438\u0437\u0432\u0438\u043d\u0435\u043d\u0438\u044f \u0437\u0430 \u043d\u0435\u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e.<\/p>\n<\/blockquote>\n<p>\u041c\u044b \u043e\u0436\u0438\u0434\u0430\u0435\u043c, \u0447\u0442\u043e \u0432\u0441\u043a\u043e\u0440\u0435 \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u0441\u0442\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 \u043d\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u043c\u0438\u0443\u043c-\u043e\u043f\u0446\u0438\u0438.<\/p>\n<p>\u0423 \u043d\u0430\u0441 \u043d\u0435 \u0442\u0430\u043a \u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043d\u0435 \u0445\u043e\u0442\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0444\u0438\u0447\u0438. \u041f\u043e\u043c\u043d\u0438\u0442\u0435: \u043c\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u0442\u0430\u0440\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>CoreModule<\/em>, \u0432\u0435\u0440\u043d\u043e? \u041c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u043e\u043a.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043b\u0430\u0441\u0441 <em>AppSuscription<\/em>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0417\u0430\u0442\u0435\u043c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 <em>AppSuscription<\/em> \u0432 <em>MainActivity<\/em> (\u043c\u043e\u0434\u0443\u043b\u044c <em>App<\/em>) \u043f\u0440\u043e\u0441\u0442\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<p>\u041a\u0430\u043a \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u043e\u0439. \u0417\u043d\u0430\u0447\u0438\u0442, \u0443 \u043d\u0430\u0441 \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 <em>SuscriptionModule<\/em>, \u0432\u0435\u0440\u043d\u043e? \u0427\u0442\u043e \u0436, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0435\u0433\u043e. \u041f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435 &#8230; \u0435\u0441\u043b\u0438 \u044d\u0442\u043e <em>AppSuscription<\/em> \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 <em>CoreModule<\/em>, \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>CoreModule<\/em>? \u041d\u0430 \u044d\u0442\u043e \u0435\u0441\u0442\u044c \u0432\u0435\u0441\u043a\u0430\u044f \u043f\u0440\u0438\u0447\u0438\u043d\u0430: \u0435\u0441\u043b\u0438 \u0441\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u043f\u0440\u0438\u0432\u044f\u0436\u0435\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438 \u043a <em>CoreModule<\/em>, \u043f\u043e\u0437\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0438\u0445 (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043c\u044b \u0441\u043b\u043e\u043c\u0430\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 <em>CoreModule<\/em>).<\/p>\n<p>\u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c <em>SuscriptionModule<\/em>:<\/p>\n<pre><code class=\"kotlin\">@Module class SuscriptionModule {      @Provides     @Singleton     fun appSuscription(         stringsProvider: StringsProvider     ): AppSuscription = AppSuscription(stringsProvider)  }<\/code><\/pre>\n<p><em>SuscriptionModule (core module)<\/em><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 <code>Module<\/code>, \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>AppSuscription<\/em>. \u041a\u0430\u043a \u044f \u0443\u0436\u0435 \u0441\u043a\u0430\u0437\u0430\u043b, \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 <em>MainActivity<\/em>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e:<\/p>\n<ul>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c Dagger \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u043e\u0434\u0443\u043b\u044f <em>App<\/em>.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c <em>CoreModule <\/em>\u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u043e\u0434\u0443\u043b\u044f <em>App<\/em> (\u043a\u0430\u043a \u044f \u043e\u0442\u043c\u0435\u0442\u0438\u043b \u0440\u0430\u043d\u0435\u0435, \u0432 \u043a\u043e\u0434\u0435 \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u044d\u0442\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c).<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u044d\u0442\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u044b, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c <code>Component<\/code> \u0434\u043b\u044f \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0432 <em>MainActivity<\/em>. <code>Component<\/code> \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>SuscriptionModule<\/em>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c <em>AppSuscription<\/em>:<\/p>\n<pre><code class=\"kotlin\">@Singleton @Component(     modules = [         SuscriptionModule::class     ] ) interface ApplicationComponent {      fun inject(activity: MainActivity)      }<\/code><\/pre>\n<p><em>ApplicationComponent (app module)<\/em><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f <code>Component<\/code> \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c <em>AppSuscription<\/em> \u0432 <em>MainActivity<\/em>:<\/p>\n<pre><code class=\"kotlin\">class MainActivity : AppCompatActivity() {    @Inject lateinit var appSuscription: AppSuscription   ...      override fun onCreate(savedInstanceState: Bundle?) {     super.onCreate(savedInstanceState)          DaggerApplicationComponent.builder()       .build()       .inject(this)          ...   }    ... }<\/code><\/pre>\n<p><em>MainActivity (app module)<\/em><\/p>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e! \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c&#8230; \u0438:<\/p>\n<pre><code class=\"kotlin\">com.example.core.resource.StringsProvider cannot be provided without an @Inject constructor or an @Provides-annotated method. public abstract interface ApplicationComponent { ^ com.example.core.resource.StringsProvider is injected at com.example.core.di.SuscriptionModule.appSuscription(arg0) com.example.core.modes.AppSuscription is injected at com.example.multimodule.MainActivity.appSuscription com.example.multimodule.MainActivity is injected at com.example.multimodule.di.ApplicationComponent.inject(com.example.multimodule.MainActivity)<\/code><\/pre>\n<p>\u0427\u0442\u043e? \u0415\u0441\u043b\u0438 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0442\u043e\u043b\u044c\u043a\u043e <em>AppSuscription<\/em>, \u0437\u0430\u0447\u0435\u043c \u043c\u043d\u0435 <em>StringsProvider<\/em>? \u0425\u043e\u0440\u043e\u0448\u043e\u2026 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043b\u0435\u0433\u043a\u0430 \u043f\u043e\u0434\u043f\u0440\u0430\u0432\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u043f\u0440\u043e\u0448\u043b\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e. \u041c\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c <em>CoreModule<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 <em>StringsProvider<\/em>:<\/p>\n<pre><code class=\"kotlin\">@Singleton @Component( modules = [     CoreModule::class,     SuscriptionModule::class ] ) interface ApplicationComponent {  fun inject(activity: MainActivity)  }<\/code><\/pre>\n<p><em>ApplicationComponent (app module)<\/em><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 <em>CoreModule<\/em> \u0432 <em>ApplicationComponent<\/em>, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c Dagger \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 <em>CoreModule<\/em> \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 <em>ApplicationComponent<\/em>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"kotlin\">class MainActivity : AppCompatActivity() {    @Inject lateinit var appSuscription: AppSuscription   ...      override fun onCreate(savedInstanceState: Bundle?) {     super.onCreate(savedInstanceState)          DaggerApplicationComponent.builder()       .coreModule(CoreModule(application))       .build()       .inject(this)          ...   }    ... }<\/code><\/pre>\n<p><em>MainActivity (app module)<\/em><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u043d\u043e!<\/p>\n<blockquote>\n<p><em>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 <\/em><a href=\"https:\/\/github.com\/JulianEzequiel\/dagger-multi-module\/commit\/71959a5a889b9ea4754dc0095e40859c7bd122f0\"><em><u>\u044d\u0442\u043e\u043c \u043a\u043e\u043c\u043c\u0438\u0442\u0435<\/u><\/em><\/a><\/p>\n<\/blockquote>\n<h2>\u0425\u0432\u0430\u0442\u0438\u0442 \u0442\u0435\u0440\u043f\u0435\u0442\u044c \u043f\u043b\u043e\u0445\u043e\u0439 \u043a\u043e\u0434<\/h2>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u044d\u0442\u0430\u043f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0432\u0430 \u0447\u0438\u0441\u043b\u0430, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u043f\u043e\u043a\u0430 \u043d\u0430\u0448 \u043a\u043e\u0434 \u2013 \u0441 \u201c\u0437\u0430\u043f\u0430\u0448\u043a\u043e\u043c\u201d. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u0432\u0430\u0441 \u0443\u0436\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0435\u0441\u0442\u044c \u0434\u0432\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b.<\/p>\n<h3>\u041f\u0435\u0440\u0432\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u2013 \u0437\u043d\u0430\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 Module \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h3>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043c\u044b \u043f\u0440\u0438\u0448\u043b\u0438 \u0432\u044b\u0448\u0435. \u041a\u043b\u0430\u0441\u0441 <em>AppSuscription<\/em> \u043d\u0435\u043b\u044c\u0437\u044f \u0431\u044b\u043b\u043e \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u043e\u043b\u044c\u043a\u043e <em>SuscriptionModule<\/em>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0435\u0439 \u0442\u0430\u043a\u0436\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u0441\u044f <em>CoreModule <\/em>(\u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0435\u043c\u0443 \u0435\u0449\u0435 \u043d\u0443\u0436\u0435\u043d <em>StringsProvider<\/em>).<\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0431\u044b\u0441\u0442\u0440\u043e \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u044f \u0431\u044b\u043b \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0438\u0441\u0430\u043b \u043a\u043e\u0434, \u0438 \u044f \u0437\u043d\u0430\u044e, \u043a\u0430\u043a\u0438\u0435 <code>Module<\/code> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043a\u043b\u0430\u0441\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u044b Dagger \u0434\u043b\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438. \u041d\u043e \u0447\u0442\u043e, \u0435\u0441\u043b\u0438:<\/p>\n<ul>\n<li>\n<p>\u042f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e <em>CoreModule<\/em> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 <em>StringsProvider<\/em>. \u0418\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u043e\u043d\u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0441\u043e\u0437\u0434\u0430\u0434\u0443\u0442 \u043d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 <em>@Provides<\/em> \u0432 \u043a\u0430\u043a\u043e\u043c-\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c <code>Module<\/code> (\u0438\u043b\u0438, \u0447\u0442\u043e \u0435\u0449\u0435 \u0445\u0443\u0436\u0435, \u043e\u043d\u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0443\u0442 \u043d\u043e\u0432\u044b\u0439 <code>Module<\/code>). \u042d\u0442\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0443\u0442 \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0440\u0430\u0437\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u0431\u0443\u0434\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 <em>StringsProvider<\/em>, \u0447\u0442\u043e \u0433\u0440\u043e\u0437\u0438\u0442 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0441 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0435\u0439 \u0438, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u043c\u043e\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u043c\u043e\u0434\u0443\u043b\u0435\u0439: \u0435\u0441\u043b\u0438 \u043c\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u0447\u043d\u0435\u0442 \u0440\u0430\u0441\u0442\u0438, \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438. \u0412\u043e \u0432\u0441\u0435\u0445 \u044d\u0442\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u044f\u0445 \u043c\u043d\u0435 \u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u201c\u043a\u043e\u0441\u0442\u044b\u043b\u0438\u201d, \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438. \u042d\u0442\u043e \u043d\u0435 \u0432\u044b\u0445\u043e\u0434.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0412\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u2013 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 Module \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438<\/h3>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u0432\u0430\u0441 \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438, \u0447\u0442\u043e <code>Module<\/code> \u0432 \u043a\u043e\u0434\u0435 \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f.<\/p>\n<ul>\n<li>\n<p>\u0414\u043b\u044f <em>DaggerCalculatorComponent<\/em> \u043d\u0443\u0436\u0435\u043d <em>CoreModule<\/em>.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f <em>DaggerApplicationComponent <\/em>\u0442\u0430\u043a\u0436\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f <em>CoreModule<\/em>.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"kotlin\">DaggerCalculatorComponent.builder()   .coreModule(CoreModule(application))   .build()   .inject(this)<\/code><\/pre>\n<p><em>DaggerCalculatorComponent (calculator module)<\/em><\/p>\n<pre><code class=\"kotlin\">DaggerApplicationComponent.builder()   .coreModule(CoreModule(application))   .build()   .inject(this)<\/code><\/pre>\n<p><em>DaggerApplicationComponent (app module)<\/em><\/p>\n<p>\u042d\u0442\u0430 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u0440\u0435\u0447\u0438\u0442 \u0438\u0434\u0435\u0435 <em>StringsProvider<\/em> \u043a\u0430\u043a \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <em>StringsProvider.<\/em><\/p>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 <em>StringsProvider<\/em> \u044d\u0442\u043e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430. \u041d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u0440\u0435\u0447\u044c \u0438\u0434\u0435\u0442 \u043e <code>Module<\/code>, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0435\u043c \u0437\u0430 \u0441\u0442\u0430\u0442\u0443\u0441 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u0425\u043e\u0442\u0438\u043c \u043b\u0438 \u043c\u044b \u0438\u043c\u0435\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u044d\u0442\u043e\u0433\u043e <code>Module<\/code> \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438?<\/p>\n<h3>\u041c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/h3>\n<p>\u041c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u043e\u0431\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u0412\u043e\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f:<\/p>\n<h4>\u041f\u0435\u0440\u0432\u043e\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/h4>\n<p>\u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u044b\u0445\u043e\u0434: \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432\u0441\u0435 \u043a\u0430\u043a \u0435\u0441\u0442\u044c. \u0412\u0441\u0435\u0433\u0434\u0430 \u0435\u0441\u0442\u044c \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 \u2013 \u043d\u0435 \u0442\u0440\u043e\u0433\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0438 \u043d\u0435 \u0431\u0440\u0430\u0442\u044c \u043d\u0430 \u0441\u0435\u0431\u044f \u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435. \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0438 \u044f \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0432\u0430\u0448 \u0441\u043b\u0443\u0447\u0430\u0439 \u0442\u0430\u043a\u043e\u0439 \u0436\u0435, \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442.<\/p>\n<h4>\u0412\u0442\u043e\u0440\u043e\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/h4>\n<p>\u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 <em>\u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435<\/em>, \u043a\u0443\u0434\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043c\u0435\u0449\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 <code>Module<\/code>, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0438\u0445 \u043f\u043e \u043c\u0435\u0440\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438. \u041d\u043e \u0443 \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0435\u0441\u0442\u044c \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0442\u0440\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b:<\/p>\n<ul>\n<li>\n<p>\u042d\u0442\u043e \u043d\u0435 \u0440\u0435\u0448\u0430\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0432\u0437\u0430\u0438\u043c\u043e\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 <code>Module<\/code>, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b\u0438 \u0440\u0430\u043d\u0435\u0435 \u043d\u0435\u044f\u0432\u043d\u043e\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 <em>@Provide<\/em>-\u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 <code>Module<\/code>).<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0438 \u043a\u0430\u043a \u0434\u043e\u043b\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043c <code>Module<\/code>? \u041a\u0430\u043a \u043c\u044b \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u043c <em>CoreModule<\/em>, \u0447\u0442\u043e \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438 \u0437\u0430\u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 <code>Module<\/code> \u0432 <em>\u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435<\/em>?<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 <code>Module<\/code> \u043d\u0435\u043b\u0435\u0433\u043a\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <em>CoreModule<\/em> \u043d\u0443\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u0432 <em>Application <\/em>\u0438 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442<em> <\/em>\u043b\u0435\u0433\u043a\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u044d\u0442\u043e\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443.<\/p>\n<\/li>\n<\/ul>\n<h4>\u0422\u0440\u0435\u0442\u044c\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/h4>\n<p>\u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c <code>Module<\/code> \u0441 <em>@Provides-<\/em>\u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0434\u0440\u0443\u0433\u0438\u0435 <em>Component<\/em>-\u044b?<\/p>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u044f \u043d\u0435 \u0437\u043d\u0430\u044e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u044d\u0442\u043e. \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0441\u043b\u043e\u0436\u043d\u043e \u0438 \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e, \u0442\u0430\u043a \u043a\u0430\u043a, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0432\u044b\u043d\u0443\u0434\u0438\u043b\u043e \u0431\u044b Dagger \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043e\u043d \u043d\u0435 \u043f\u0440\u0438\u0441\u043f\u043e\u0441\u043e\u0431\u043b\u0435\u043d.<\/p>\n<p>\u0422\u0430\u043a \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043d\u043e &#8230; \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c <code>Module<\/code> \u0441 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 <em>@Provides<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0434\u0440\u0443\u0433\u0438\u0435 <code>Module<\/code>? \u0427\u0435\u0441\u0442\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u044f \u043d\u0435 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b. \u042f \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u0443 \u043d\u0435\u0433\u043e \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441\u043e \u0441\u043a\u043e\u0443\u043f\u0430\u043c\u0438 \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 <em>Component<\/em>, \u0447\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u0435\u0441\u043a\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u043d\u0435 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e.<\/p>\n<h2>\u0422\u0430\u043a \u0447\u0442\u043e \u0436\u0435 \u043d\u0430\u043c \u0434\u0435\u043b\u0430\u0442\u044c?<\/h2>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430\u0448\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043f\u043e \u0447\u0430\u0441\u0442\u044f\u043c \u2013 \u0442\u0430\u043a \u0435\u0451 \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0433\u0447\u0435 \u0440\u0435\u0448\u0438\u0442\u044c. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043a\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0432\u0437\u0430\u0438\u043c\u043e\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 <code>Module<\/code> \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439.<\/p>\n<h3>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 Module \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430<\/h3>\n<p>\u041a\u0430\u043a \u044f \u0440\u0430\u043d\u0435\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b, \u043c\u044b \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0445\u043e\u0442\u0438\u043c \u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043d\u0443\u0436\u043d\u044b <code>Module<\/code>. \u041f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u043d\u0435 \u0432 \u0442\u0430\u043a\u0438\u0445 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u044f\u0445, \u043a\u0430\u043a \u043e\u0448\u0438\u0431\u043a\u0438 \u0441 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 <em>@Provides-<\/em>\u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438.<\/p>\n<p>\u0423 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 <em>@Module<\/em> \u0435\u0441\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439, \u043a\u0430\u043a\u0438\u0435 <code>Module<\/code> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u043d\u0435\u0433\u043e. \u042d\u0442\u043e\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <em>\u2013<\/em> <em>includes<\/em>.<\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438:<\/p>\n<ul>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c <em>CoreModule<\/em> \u0432 <em>SuscriptionModule<\/em>, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u0438\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0423\u0431\u0440\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <em>CoreModule<\/em> \u0432 <em>ApplicationComponent<\/em>.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"kotlin\">@Module(includes = [CoreModule::class]) class SuscriptionModule {   ... }<\/code><\/pre>\n<p><em>SuscriptionModule (core module)<\/em><\/p>\n<pre><code class=\"kotlin\">@Singleton @Component(   modules = [     SuscriptionModule::class   ] ) interface ApplicationComponent {    fun inject(activity: MainActivity)  }<\/code><\/pre>\n<p><em>ApplicationComponent (app module)<\/em><\/p>\n<p><strong>\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435! \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0435\u0449\u0435 \u043d\u0435 \u0440\u0435\u0448\u0435\u043d\u044b<\/strong>: Dagger \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442, \u043a\u0430\u043a\u0443\u044e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c <em>CoreModule<\/em> \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c.<\/p>\n<pre><code class=\"kotlin\">DaggerApplicationComponent.builder()   .coreModule(CoreModule(application))   .build()   .inject(this)<\/code><\/pre>\n<p><em>DaggerApplicationComponent (app module)<\/em><\/p>\n<p>\u0418\u0442\u0430\u043a, \u043c\u044b \u043d\u0435 \u043d\u0430\u0448\u043b\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u041d\u043e, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 <em>SuscriptionModule<\/em> \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <em>CoreModule<\/em>.<\/p>\n<p>\u0418, \u043a\u0430\u043a \u0431\u043e\u043d\u0443\u0441, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0430 \u0435\u0449\u0435 \u043b\u0443\u0447\u0448\u0435. \u0420\u0430\u043d\u0435\u0435 \u043e\u0448\u0438\u0431\u043a\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u043b\u0430\u0441\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u0437\u0430\u0431\u044b\u0432\u0430\u043b\u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c <em>StringsProvider<\/em>. \u041d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u0432 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0443:<\/p>\n<pre><code class=\"kotlin\">Caused by: java.lang.IllegalStateException: com.example.core.di.CoreModule must be set<\/code><\/pre>\n<p>\u041d\u0430\u043c\u043d\u043e\u0433\u043e \u043b\u0443\u0447\u0448\u0435, \u043f\u0440\u0430\u0432\u0434\u0430? \ud83d\ude00<\/p>\n<blockquote>\n<p><em>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 <\/em><a href=\"https:\/\/github.com\/JulianEzequiel\/dagger-multi-module\/commit\/bb4577486584ed2a015844d72e09844757c30e3f\"><em><u>\u044d\u0442\u043e\u043c \u043a\u043e\u043c\u043c\u0438\u0442\u0435<\/u><\/em><\/a><\/p>\n<\/blockquote>\n<h3>\u0425\u0432\u0430\u0442\u0438\u0442 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c Module<\/h3>\n<p>\u042f \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0438\u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0435 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e, \u043d\u043e, \u043a\u0430\u043a \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u2013 \u0432\u0440\u0430\u0433 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0433\u043e.<\/p>\n<p>\u0412\u0441\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043d\u0430\u0448\u0435\u043b, \u043f\u043e\u043a\u0430 \u0438\u0441\u043a\u0430\u043b \u0438 \u0447\u0438\u0442\u0430\u043b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e, \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044e\u0442 \u0441\u0432\u044f\u0437\u044c \u043c\u0435\u0436\u0434\u0443 \u0432\u0441\u0435\u043c\u0438 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438, \u0438\u043c\u0435\u044e\u0449\u0438\u043c\u0438 <code>Component<\/code>, \u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c <em>Application<\/em>. \u0421\u043a\u043e\u0440\u043e \u043c\u044b \u044d\u0442\u043e \u0443\u0432\u0438\u0434\u0438\u043c.<\/p>\n<p>\u041c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/developer.android.com\/training\/dependency-injection\/dagger-multi-module\"><u>\u043f\u043e\u0434\u0445\u043e\u0434, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c\u044b\u0439 Google<\/u><\/a>.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0442\u043c\u0435\u0442\u0438\u043c \u0435\u0449\u0435 \u043c\u0438\u043d\u0443\u0441\u044b: \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0438\u043c\u0435\u0435\u0442 \u0441\u043a\u0440\u044b\u0442\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u0447\u0442\u043e \u043d\u0430\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043c\u0430\u043d\u0434, \u0438 \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u043d\u0438\u0445 <em>\u2013<\/em> \u043d\u0430\u0434 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u043c\u043e\u0434\u0443\u043b\u0435\u043c. \u041f\u0440\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0432\u0437\u0430\u0438\u043c\u043e\u0441\u0432\u044f\u0437\u0438 \u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044f \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0443 \u043d\u0430\u0441 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043c\u0430\u043d\u0434, \u0430 \u0432 \u0445\u0443\u0434\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438 \u0432\u043e\u0432\u0441\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0431\u043b\u043e\u043a\u0435\u0440\u044b.<\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0435 \u0438 \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0435\u0441\u0442\u044c, \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u044d\u0442\u043e \u043f\u043e\u0437\u0436\u0435.<\/p>\n<p>\u0425\u0432\u0430\u0442\u0438\u0442 \u0442\u0435\u043e\u0440\u0438\u0438 \u0438 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0439, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043a\u043e\u0434\u0438\u0442\u044c!<\/p>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0441 <code>Component<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u043d\u0435\u0434\u0440\u044f\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0435\u043c\u0443 <code>Component<\/code>.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 <em>Calculator<\/em> \u043d\u0430\u0448\u0438\u043c <code>Component<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <em>CalculatorComponent<\/em>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <em>CalculatorComponentProvider<\/em>:<\/p>\n<pre><code class=\"kotlin\">interface CalculatorComponentProvider {    fun getCalculatorComponent(): CalculatorComponent  }<\/code><\/pre>\n<p><em>CalculatorComponentProvider (calculator module)<\/em><\/p>\n<p>\u041c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f <em>CalculatorComponent<\/em>. \u041a\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0442\u044c <em>CalculatorComponentProvider<\/em>? \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u0438\u0437 <em>Activity\/Fragment<\/em>, \u0438 \u0442\u043e\u0442 \u0436\u0435 \u0441\u0430\u043c\u044b\u0439, \u0447\u0442\u043e \u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0432 \u0446\u0435\u043b\u043e\u043c: <em>Application<\/em>.<\/p>\n<p>\u041a\u0430\u043a\u043e\u0439 <em>Application<\/em>? \u0422\u043e\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0441\u043e\u0437\u0434\u0430\u044e \u0441\u0435\u0439\u0447\u0430\u0441! (\u0434\u0430, \u0435\u0433\u043e \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u043d\u0435 \u0431\u044b\u043b\u043e).<\/p>\n<pre><code class=\"kotlin\">class CustomApplication : Application(),     CalculatorComponentProvider {      override fun getCalculatorComponent(): CalculatorComponent {         return DaggerCalculatorComponent.builder()             .coreModule(getCoreModule())             .build()     }      private fun getCoreModule(): CoreModule = CoreModule(this)  }<\/code><\/pre>\n<p><em>CustomApplication (app module)<\/em><\/p>\n<p>\u041f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c <em>CalculatorComponent<\/em>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441:<\/p>\n<pre><code class=\"kotlin\">class CalculatorActivity : AppCompatActivity() {   ...    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)       ...            (application as CalculatorComponentProvider)         .getCalculatorComponent()         .inject(this)            ...   }      ... }<\/code><\/pre>\n<p><em>CalculatorActivity (calculator module)<\/em><\/p>\n<p>\u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0434\u043b\u044f <em>MainActivity<\/em>. \u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c <em>ApplicationComponentProvider<\/em>, \u0437\u0430\u0442\u0435\u043c \u0432 <em>Application <\/em>\u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u044d\u0442\u043e\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0438, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c <em>ApplicationComponent<\/em> \u0432 <em>MainActivity<\/em>:<\/p>\n<pre><code class=\"kotlin\">interface ApplicationComponentProvider {      fun getApplicationComponent(): ApplicationComponent  }<\/code><\/pre>\n<p><em>ApplicationComponentProvider (app module)<\/em><\/p>\n<pre><code class=\"kotlin\">class CustomApplication : Application(),   CalculatorComponentProvider,   ApplicationComponentProvider {   ...    override fun getApplicationComponent(): ApplicationComponent {       return DaggerApplicationComponent.builder()           .coreModule(getCoreModule())           .build()   }    private fun getCoreModule(): CoreModule = CoreModule(this)  }<\/code><\/pre>\n<p><em>CustomApplication (app module)<\/em><\/p>\n<pre><code class=\"kotlin\">class MainActivity : AppCompatActivity() {   ...      override fun onCreate(savedInstanceState: Bundle?) {     ...          (application as ApplicationComponentProvider)             .getApplicationComponent()             .inject(this)          ...   }      ... }<\/code><\/pre>\n<p><em>MainActivity (app module)<\/em><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 <code>Component<\/code>\u00a0 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u041d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043e\u0434\u043d\u043e\u0433\u043e: <em>CoreModule<\/em> \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0435\u0437\u0434\u0435, \u0433\u0434\u0435 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u0438 \u044d\u0442\u043e \u043d\u0435 \u0442\u043e, \u0447\u0435\u0433\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c. \u041c\u044b \u0445\u043e\u0442\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u0443 \u043d\u0430\u0441 \u0431\u044b\u043b \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0435\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043d\u0430 \u0432\u0441\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0415\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443. \u042f \u0432\u044b\u0431\u0435\u0440\u0443 \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044e <em>CoreModule<\/em> \u0432 <em>CustomApplication<\/em>. \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u044f \u043d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0432\u0430\u043c \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u043e\u0435 \u043d\u0435 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u0442\u0441\u044f. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Map \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f <code>Modules<\/code> \u0438\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 &#8230; \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432.<\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"kotlin\">class CustomApplication : Application(),   CalculatorComponentProvider,   ApplicationComponentProvider {    private val coreModule: CoreModule by lazy {     CoreModule(this)   }    override fun getCalculatorComponent(): CalculatorComponent {     return DaggerCalculatorComponent.builder()       .coreModule(coreModule)       .build()   }    override fun getApplicationComponent(): ApplicationComponent {     return DaggerApplicationComponent.builder()       .coreModule(coreModule)       .build()   }  }<\/code><\/pre>\n<p><em>CustomApplication (app module)<\/em><\/p>\n<blockquote>\n<p><em>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 <\/em><a href=\"https:\/\/github.com\/JulianEzequiel\/dagger-multi-module\/commit\/52dce8e37f8fb0874484a66e3266e4f2f817f608\"><em><u>\u044d\u0442\u043e\u043c \u043a\u043e\u043c\u043c\u0438\u0442\u0435<\/u><\/em><\/a><\/p>\n<\/blockquote>\n<p><strong>\u0411\u043e\u043d\u0443\u0441: \u0440\u0430\u043d\u0435\u0435 \u044f \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b, \u0447\u0442\u043e \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0435 \u0438 \u043b\u0438\u0448\u044c \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u043c\u0435\u0436\u0434\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432.<\/strong><\/p>\n<p>\u0423 \u043a\u0430\u0436\u0434\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0432\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 App-\u043c\u043e\u0434\u0443\u043b\u044f, \u043a\u0430\u043a \u0443 \u043d\u0430\u0441. \u0423 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 <em>Application<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0448 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <em>ComponentProvider<\/em>, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 <code>Component<\/code>. \u0418\u0442\u0430\u043a, \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u043e\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u0440\u0443\u0433\u0438\u0445 \u043a\u043e\u043c\u0430\u043d\u0434.<\/p>\n<h2>\u041f\u043e\u0434\u0432\u043e\u0434\u0438\u043c \u0438\u0442\u043e\u0433: \u043a\u0430\u043a \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b?<\/h2>\n<ul>\n<li>\n<p>\u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 <code>Module<\/code> \u043e\u0442 \u0434\u0440\u0443\u0433\u0438\u0445 <code>Module<\/code> \u0431\u0443\u0434\u0443\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>@Module(includes = [...])<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0435\u0441\u0442\u044c <code>Component<\/code>, \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <em>ComponentProvider<\/em> \u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u044d\u0442\u043e\u0442 <code>Component<\/code>. \u0422\u0430\u043a\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043d\u0430\u0448\u0438\u043c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u043c <em>Application<\/em>.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044c \u0438\u043c\u0435\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u043e\u0434\u043d\u043e\u0433\u043e <code>Component<\/code>, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <em>ComponentProvider<\/em> \u0434\u043b\u044f \u0432\u0441\u0435\u0445. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u0447\u0442\u043e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u044d\u0442\u043e &#8230; \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u043c\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u043a\u0430\u0436\u0434\u043e\u0439 <em>Activity<\/em>, \u0433\u0434\u0435 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>Component<\/code>, \u043d\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 <em>Application<\/em> \u043a \u0442\u0438\u043f\u0443 <em>ComponentProvider<\/em> \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0439 <code>Component<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0412\u0430\u0436\u043d\u043e\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435: Component-\u044b \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 Scope<\/strong><\/p>\n<p>\u0412 \u043f\u043e\u0434\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 Dagger \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0438\u0434\u0435\u0442\u044c <code>Component<\/code> \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 Scopes.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443 \u043d\u0430\u0441 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c <code>Component<\/code>, \u00a0\u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u043a \u0441\u043a\u043e\u0443\u043f\u0443 <em>Activity. <\/em>\u0410 \u043c\u043e\u0434\u0443\u043b\u044c, \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0432 \u044d\u0442\u043e\u0442 <code>Component<\/code>, \u043c\u043e\u0436\u0435\u0442 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 <em>Activity, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0435\u0433\u043e<\/em> \u0441\u043a\u043e\u0443\u043f. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <em>ComponentProvider<\/em> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f <code>Component<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e <em>Application<\/em> \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 <em>Activity<\/em>.<\/p>\n<p>\u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439<em> <\/em><code>Component<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0432 <em>Application<\/em>.\u00a0<\/p>\n<p>\u0410 <code>Component<\/code> \u0441\u043e \u0441\u043a\u043e\u0443\u043f\u0430\u043c\u0438, \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u043c\u0438 \u043a <em>Activity<\/em>, \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0433\u043e <em>Subcomponent<\/em>.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439<em> <\/em><code>Component<\/code> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <em>ComponentProvider<\/em>, \u0430 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0433\u043e \u0443\u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c <em>Subcomponent<\/em> \u0441\u043e \u0441\u043a\u043e\u0443\u043f\u043e\u043c <em>Activity<\/em>.\u00a0<\/p>\n<h3>\u0412\u044b\u0432\u043e\u0434<\/h3>\n<p>\u0427\u0442\u043e \u0436, \u043f\u043e\u0441\u043b\u0435 \u0434\u043e\u043b\u0433\u043e\u0433\u043e \u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u044f \u043c\u044b \u0434\u043e\u0441\u0442\u0438\u0433\u043b\u0438 \u0441\u0432\u043e\u0435\u0439 \u0446\u0435\u043b\u0438: \u0440\u0435\u0448\u0438\u0442\u044c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043c\u0435\u0436\u0434\u0443 Dagger \u0438 \u043c\u043d\u043e\u0433\u043e\u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u043d\u0430 Android.<\/p>\n<p>\u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0432 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e \u0442\u0435\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438. \u0410 \u043f\u043e\u043a\u0430 \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0432\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c \u044d\u0442\u043e \u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u0435, \u0438 \u0432\u044b \u0443\u0437\u043d\u0430\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u043d\u043e\u0432\u043e\u0435 \u0438\u043b\u0438, \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u043b\u0438 \u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0448\u0438\u0440\u0435.<\/p>\n<p><strong>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/strong><\/p>\n<p><strong>\u0410\u0432\u0442\u043e\u0440\u0441\u043a\u0438\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b \u0434\u043b\u044f mobile-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u043c \u0432 \u043d\u0430\u0448\u0438\u0445 \u0441\u043e\u0446\u0441\u0435\u0442\u044f\u0445 \u2013 <\/strong><a href=\"https:\/\/vk.com\/simbirsoft\"><strong><u>\u0412\u041a\u043e\u043d\u0442\u0430\u043a\u0442\u0435<\/u><\/strong><\/a><strong> \u0438 <\/strong><a href=\"https:\/\/t.me\/+pK7Kj9d-JfNjZjA6\"><strong><u>Telegram<\/u><\/strong><\/a><strong>.<\/strong><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/590203\/\"> https:\/\/habr.com\/ru\/articles\/590203\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<blockquote>\n<p>\u041d\u0430\u0448\u0435 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0435 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 <a href=\"https:\/\/habr.com\/ru\/users\/mobileSimbirSoft\/posts\/\"><u>\u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442<\/u><\/a> \u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u043e\u043f\u044b\u0442\u043e\u043c, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u0435 \u0441\u0442\u0430\u0442\u044c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0441\u043e\u0441\u043b\u0443\u0436\u0438\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u0445\u043e\u0440\u043e\u0448\u0443\u044e \u0441\u043b\u0443\u0436\u0431\u0443. <a href=\"https:\/\/proandroiddev.com\/android-multi-module-dagger-a-real-use-case-step-by-step-bbc03500f2f9\">\u042d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e<\/a> \u043f\u043e Android, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e \u0432 2020 \u0433\u043e\u0434\u0443, \u043c\u044b \u0432\u044b\u0431\u0440\u0430\u043b\u0438, \u0438\u0437\u0443\u0447\u0430\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0438 \u043f\u0435\u0440\u0435\u0432\u0435\u043b\u0438 \u0441 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0430\u0432\u0442\u043e\u0440\u0430. \u0421 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043e\u043d \u043e\u0441\u0432\u0435\u0449\u0430\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0438\u0435 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 Dagger \u0432 \u043c\u043d\u043e\u0433\u043e\u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0438 \u0434\u0430\u0435\u0442 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0438\u0445 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c, \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0432 \u043f\u0440\u0438\u00a0 \u044d\u0442\u043e\u043c \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0435 \u043f\u043e\u0433\u0440\u0443\u0436\u0430\u0442\u044c\u0441\u044f \u0432 \u0442\u0435\u043c\u0443 \u043c\u043d\u043e\u0433\u043e\u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 Dagger, \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0440\u044f\u0434\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0440\u0435\u0448\u0438\u0442\u044c \u0442\u0435, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0432\u044b \u0443\u0436\u0435 \u043c\u043e\u0433\u043b\u0438 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0441 \u043e\u043f\u044b\u0442\u043e\u043c \u0442\u043e\u0436\u0435, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u043d\u0430\u0439\u0434\u0443\u0442 \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u043e\u0432\u0435\u0442\u044b \u0438\u043b\u0438 \u0436\u0435 \u0438\u0434\u0435\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u0441\u043a\u0430\u0436\u0443\u0442 \u043d\u043e\u0432\u044b\u0435 \u043f\u0443\u0442\u0438 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438 \u0432 \u043c\u043d\u043e\u0433\u043e\u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435. <\/p>\n<\/blockquote>\n<p><strong>\u041e\u0442 \u0430\u0432\u0442\u043e\u0440\u0430:<\/strong> \u043f\u0440\u0435\u0436\u0434\u0435, \u0447\u0435\u043c \u043c\u044b \u043d\u0430\u0447\u043d\u0435\u043c, \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u0434\u043b\u0438\u043d\u043d\u043e\u0439. \u0412\u043c\u0435\u0441\u0442\u0435 \u043c\u044b \u0448\u0430\u0433 \u0437\u0430 \u0448\u0430\u0433\u043e\u043c \u043d\u0430\u0439\u0434\u0435\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0443. \u0426\u0435\u043b\u044c\u044e \u0431\u044b\u043b\u043e \u043f\u043e\u044d\u0442\u0430\u043f\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Dagger \u0432\u043d\u0435\u0434\u0440\u044f\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u043c\u043d\u043e\u0433\u043e\u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0448\u0430\u0433\u0430 \u0431\u0443\u0434\u0435\u0442 \u0434\u0430\u043d\u0430 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043a\u043e\u043c\u043c\u0438\u0442, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u0434\u0435\u043b\u0430\u043d\u044b \u044d\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u043a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043f\u043e\u043a\u0430\u0436\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u0434\u0430.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u0435\u043c \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0445\u043e\u0442\u044f \u0431\u044b \u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0437\u043d\u0430\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>kotlin<\/p>\n<\/li>\n<li>\n<p>\u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 component \u0432 dagger<\/p>\n<\/li>\n<li>\n<p>\u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 module \u0432 dagger<\/p>\n<\/li>\n<li>\n<p>\u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 scope \u0432 dagger<\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u043e \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 Kotlin \u043c\u044b \u043f\u0438\u0441\u0430\u043b\u0438 <\/em><a href=\"https:\/\/habr.com\/ru\/company\/simbirsoft\/blog\/546452\/\"><em><u>\u0437\u0434\u0435\u0441\u044c<\/u><\/em><\/a><em>, \u0430 \u043f\u043e Dagger \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c \u0441\u0435\u0440\u0438\u044e \u0441\u0442\u0430\u0442\u0435\u0439 \u2013 \u0447\u0430\u0441\u0442\u0438 <\/em><a href=\"https:\/\/habr.com\/ru\/post\/279125\/\"><em><u>1<\/u><\/em><\/a><em>, <\/em><a href=\"https:\/\/habr.com\/ru\/post\/279641\/\"><em><u>2<\/u><\/em><\/a><em>, <\/em><a href=\"https:\/\/habr.com\/ru\/post\/320676\/\"><em><u>3<\/u><\/em><\/a><em>.\u00a0<\/em><\/p>\n<\/blockquote>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/developer.android.com\/training\/dependency-injection\/dagger-multi-module#best-practices\"><u>\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u044f\u043c Google \u043f\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e Dagger<\/u><\/a> (\u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0446\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043d\u0438\u0436\u0435). \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043b\u0435\u043d\u044c \u0447\u0438\u0442\u0430\u0442\u044c, \u043c\u043e\u0436\u043d\u043e \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/github.com\/JulianEzequiel\/dagger-multi-module\"><u>\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 GitHub<\/u><\/a>, \u043e\u0434\u043d\u0430\u043a\u043e, \u043d\u0435 \u0443\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0441\u0430\u043c\u043e\u0435 \u0432\u0430\u0436\u043d\u043e\u0435.<\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439!<\/p>\n<ul>\n<li>\n<p>\u041e \u043c\u043e\u0434\u0443\u043b\u044f\u0445 Dagger \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c <code>Module<\/code>, \u0430 \u043e \u043c\u043e\u0434\u0443\u043b\u044f\u0445 Android \u2013 \u043f\u0440\u043e\u0441\u0442\u043e \u00ab\u043c\u043e\u0434\u0443\u043b\u0438\u00bb (\u0431\u0435\u0437 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f).\u00a0<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435 <code>\u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435<\/code>, \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u043a\u043b\u0430\u0441\u0441\u0430\u0445 Dagger.<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0442\u0430\u043a, \u043d\u0430\u0447\u043d\u0435\u043c!<\/p>\n<figure class=\"full-width\"><\/figure>\n<h3>\u041f\u0440\u043e\u0435\u043a\u0442<\/h3>\n<p>\u041c\u044b \u0445\u043e\u0442\u0438\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f, \u0433\u0440\u0430\u0444\u0438\u043a\u0438, \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0444\u043e\u0440\u043c\u0443\u043b \u0438 \u0442.\u0434.<\/p>\n<p>\u041d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0441\u0443\u043c\u043c\u044b, \u0438 \u044d\u0442\u043e \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0441\u043e\u0432\u0441\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u043c, \u043d\u0435 \u0442\u0430\u043a \u043b\u0438?<\/p>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u043b\u044e\u0431\u0438\u043c \u0445\u0430\u0439\u043f \u0438 \u0445\u043e\u0442\u0438\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u043c. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0434\u0432\u0430 \u043c\u043e\u0434\u0443\u043b\u044f:<\/p>\n<ul>\n<li>\n<p><em>\u041c\u043e\u0434\u0443\u043b\u044c App<\/em> \u2013 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u0438.<\/p>\n<\/li>\n<li>\n<p><em>\u041c\u043e\u0434\u0443\u043b\u044c Calculator<\/em>, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f (\u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0443\u043c\u043c\u0430).<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0435\u0445\u0430\u043b\u0438 \u0434\u0430\u043b\u044c\u0448\u0435!<\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u044f Calculator<\/h3>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c <em>App<\/em> \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 Android Studio.\u00a0<\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c <em>Calculator<\/em> \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u0443\u043c\u043c\u044b. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u0434\u0432\u0430 \u0447\u0438\u0441\u043b\u0430 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438\u0445 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u043d\u0430\u0447\u043d\u0435\u043c:<\/p>\n<ul>\n<li>\n<p>\u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c <em>Activity<\/em> \u0434\u043b\u044f \u0432\u0432\u043e\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/li>\n<li>\n<p>\u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c <em>Use Case<\/em>, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 \u0447\u0438\u0441\u0435\u043b.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u044f\u0441\u043d\u044e, \u0447\u0442\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043b\u043e\u0435\u0432, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0448\u0438\u0441\u044c <em>Activity<\/em> \u0441 \u043e\u0434\u043d\u0438\u043c <em>Use Case<\/em>. \u041f\u043e\u0437\u0436\u0435 \u043c\u044b \u0443\u0431\u0435\u0434\u0438\u043c\u0441\u044f, \u0447\u0442\u043e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u043d\u0435 \u0442\u0430\u043a \u0432\u0430\u0436\u0435\u043d, \u043a\u0430\u043a \u0447\u0435\u0442\u043a\u043e\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0440\u0435\u0448\u0438\u0442\u044c.<\/p>\n<p><em>Use Case<\/em> \u0438 <em>Activity<\/em> \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"kotlin\">lateinit var sumUseCase: SumUseCase  override fun onCreate(savedInstanceState: Bundle?) {     super.onCreate(savedInstanceState)      sumUseCase = SumUseCase() }<\/code><\/pre>\n<p><em>CalculatorActivity (calculator module)<\/em><\/p>\n<pre><code class=\"kotlin\">class SumUseCase {      fun execute(firstNumber: Int, secondNumber: Int): Int {         return firstNumber + secondNumber     }  }<\/code><\/pre>\n<p><em>SumUseCase (calculator module)<\/em><\/p>\n<p>\u0412 \u043a\u043e\u0434\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u043a\u043e\u0435-\u0447\u0442\u043e, <strong>\u043d\u0435<\/strong> \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435:<\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 UI \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0432\u0432\u043e\u0434\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u043a\u043e\u0434 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043c\u0435\u0436\u0434\u0443 <em>Activity<\/em> \u0438 <em>Use Case<\/em>.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u043c\u043e\u0434\u0443\u043b\u044c <em>Calculator<\/em> \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u043e\u0434\u0443\u043b\u044f <em>App<\/em>, \u0447\u0442\u043e\u0431\u044b \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>Activity<\/em> \u0438\u0437 <em>MainActivity<\/em> (\u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u044d\u0442\u043e \u043f\u043e\u0437\u0436\u0435).<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0430 \u043d\u0430 <em>MainActivity<\/em>, \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0441\u044f <em>CalculatorActivity<\/em> (\u043f\u043e\u0437\u0436\u0435 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0438 \u044d\u0442\u043e).<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u0438 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u0434\u0430 \u043d\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u0441\u0442\u0430\u0442\u044c\u0435. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0432\u044b \u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c <em>Activity<\/em>, <em>OnClickListener<\/em> \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c <em>Activity<\/em>.<\/p>\n<blockquote>\n<p><em>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 <\/em><a href=\"https:\/\/github.com\/JulianEzequiel\/dagger-multi-module\/commit\/e6f8b765602e548e71fe4ac257c729b7c7f9a8eb\"><em><u>\u044d\u0442\u043e\u043c \u043a\u043e\u043c\u043c\u0438\u0442\u0435<\/u><\/em><\/a><\/p>\n<\/blockquote>\n<h3>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 Dagger2 \u0432 \u043c\u043e\u0434\u0443\u043b\u044c Calculator<\/h3>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438:<\/p>\n<pre><code class=\"kotlin\">apply plugin: 'kotlin-kapt'  ...  dependencies {   ...      api \"com.google.dagger:dagger:${dagger.version}\" \/\/I'm using 2.27   kapt \"com.google.dagger:dagger-compiler:${dagger.version}\" \/\/I'm using 2.27 }<\/code><\/pre>\n<p><em>build.gradle (calculator module)<\/em><\/p>\n<blockquote>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044e. Google \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442:<\/p>\n<p><em>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b Dagger \u0432 \u043c\u043e\u0434\u0443\u043b\u044f\u0445, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u043f\u043e\u043b\u044f \u0432 \u044d\u0442\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u0435 \u0438\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0436\u0438\u0437\u043d\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u043c \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/em><\/p>\n<\/blockquote>\n<p>\u0418\u0442\u0430\u043a, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f <em>Activity<\/em> \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u0438 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f <code>Component<\/code> \u0434\u043b\u044f \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0432 \u043d\u0435\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c <code>Component<\/code> \u0438 <code>Module<\/code>:<\/p>\n<pre><code class=\"kotlin\">@Singleton @Component(modules = [CalculatorModule::class]) interface CalculatorComponent {      fun inject(calculatorActivity: CalculatorActivity)  }<\/code><\/pre>\n<p><em>CalculatorComponent (calculator module)<\/em><\/p>\n<pre><code class=\"kotlin\">@Module class CalculatorModule {      @Provides     @Singleton     fun sumUseCase(): SumUseCase = SumUseCase()  }<\/code><\/pre>\n<p><em>CalculatorModule (calculator module)<\/em><\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c Dagger \u0434\u043b\u044f \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f <em>UseCase<\/em> \u0432 <em>Activity<\/em>:<\/p>\n<pre><code class=\"kotlin\">class CalculatorActivity : AppCompatActivity() {     @Inject lateinit var sumUseCase: SumUseCase      ...      override fun onCreate(savedInstanceState: Bundle?) {         super.onCreate(savedInstanceState)                  ...         DaggerCalculatorComponent.builder().build()             .inject(this)         ...    }      ... }<\/code><\/pre>\n<p><em>CalculatorActivity (calculator module)<\/em><\/p>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0435! \u041c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 Dagger \u0432 \u043c\u043e\u0434\u0443\u043b\u044c <em>Calculator<\/em>, \u0447\u0442\u043e\u0431\u044b \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c \u043d\u0430\u0448\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<blockquote>\n<p><em>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 <\/em><a href=\"https:\/\/github.com\/JulianEzequiel\/dagger-multi-module\/commit\/e6f8b765602e548e71fe4ac257c729b7c7f9a8eb\"><em><u>\u044d\u0442\u043e\u043c <\/u><\/em><\/a><a href=\"https:\/\/github.com\/JulianEzequiel\/dagger-multi-module\/commit\/2cbd2273cfdfbac8a8dfb1094b9b860def115ea0\"><em><u>\u043a\u043e\u043c\u043c\u0438\u0442\u0435<\/u><\/em><\/a><\/p>\n<\/blockquote>\n<h3>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Use Case<\/h3>\n<p>\u0412 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u0445 \u043a <em>Use Case<\/em> \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, \u0447\u0442\u043e \u0434\u043b\u044f \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u0447\u0438\u0441\u0435\u043b \u043e\u0431\u0430 \u0438\u0437 \u043d\u0438\u0445 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438, \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0443\u043b\u044f. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435.<\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 (\u0443\u0441\u043f\u0435\u0448\u043d\u043e\/\u043e\u0448\u0438\u0431\u043a\u0430) \u0432 <em>Use Case<\/em> \u044f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>Sealed Class<\/code> (\u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0443\u0433\u043b\u0443\u0431\u043b\u044f\u0442\u044c\u0441\u044f, \u0442.\u043a. \u044d\u0442\u043e \u043d\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u0442\u0430\u0442\u044c\u0438). \u0422\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"kotlin\">class SumUseCase {      fun execute(firstNumber: Int, secondNumber: Int): Result {         return if (firstNumber > 0 &amp;&amp; secondNumber > 0) {             Result.Success(firstNumber + secondNumber)         } else {             Result.Failure(\"Both numbers must be greater than 0!!\")         }     }      sealed class Result {         class Success(val result: Int) : Result()         class Failure(val message: String) : Result()     }  }<\/code><\/pre>\n<p><em>SumUseCase (calculator module)<\/em><\/p>\n<p>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0432 <em>Activity<\/em>:<\/p>\n<ul>\n<li>\n<p><strong>\u0423\u0441\u043f\u0435\u0448\u043d\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 (Result.Success) <\/strong>\u2013 \u043f\u043e\u043a\u0430\u0436\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0441\u0443\u043c\u043c\u0443 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b.<\/p>\n<\/li>\n<li>\n<p><strong>\u041e\u0448\u0438\u0431\u043a\u0430 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 (Result.Failure) <\/strong>\u2013 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u0432\u0438\u0434\u0438\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 (\u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0435\u0451 \u0432 \u043a\u043e\u0434\u0435). <\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p><em>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 <\/em><a href=\"https:\/\/github.com\/JulianEzequiel\/dagger-multi-module\/commit\/07c450f6608cd66f26d8bcabd4142542a1f4b554\"><em><u>\u044d\u0442\u043e\u043c \u043a\u043e\u043c\u043c\u0438\u0442\u0435<\/u><\/em><\/a><\/p>\n<\/blockquote>\n<h2>\u0417\u0430\u0445\u0430\u0440\u0434\u043a\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u2013 \u044d\u0442\u043e \u043d\u0435 \u0435\u0441\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u043e<\/h2>\n<p>\u0423 \u043d\u0430\u0441 \u043f\u0435\u0440\u0432\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430! \u0421\u0442\u0440\u043e\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043e\u0448\u0438\u0431\u043a\u0443 \u043f\u0440\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u0437\u0430\u0445\u0430\u0440\u0434\u043a\u043e\u0436\u0435\u043d\u0430, \u043d\u043e \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430 \u0438 \u0447\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c \u0432 <em>strings.xml<\/em>.<\/p>\n<p>\u0414\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0441\u0442\u0440\u043e\u043a\u0430\u043c \u0438\u0437 <em>strings.xml<\/em> \u043d\u0443\u0436\u0435\u043d <em>Context<\/em>, \u043d\u043e \u0443 <em>Use Case<\/em> \u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a <em>Context<\/em>.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u044f \u0441\u043e\u0437\u0434\u0430\u044e <em>StringsProvider<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u043e \u0435\u0435 id:<\/p>\n<pre><code class=\"kotlin\">class StringsProvider(     val application: Application ) {      fun getString(@StringRes id: Int): String = application.getString(id)  }<\/code><\/pre>\n<p><em>StringsProvider (calculator module)<\/em><\/p>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <em>Application<\/em>, \u0430 \u043d\u0435 <em>Context<\/em>? \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u0430\u043a\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u044f \u043c\u043e\u0433\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>StringsProvider<\/em> \u043a\u0430\u043a Singleton, \u0438 \u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 <em>Activity<\/em> \u0438\u043b\u0438 <em>Fragment<\/em>.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c <em>StringsProvider<\/em> \u0432 <em>Use Case<\/em>:<\/p>\n<pre><code class=\"kotlin\">class SumUseCase(     val stringsProvider: StringsProvider ) {      fun execute(firstNumber: Int, secondNumber: Int): Result {         ...             Result.Failure(stringsProvider.getString(R.string.both_numbers_must_be_positive))         ...     }          ... }<\/code><\/pre>\n<p><em>SumUseCase (calculator module)<\/em><\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c <code>Module<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 <em>Use Case<\/em>. \u0411\u0435\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c! \u0421 Dagger \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<ul>\n<li>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0434\u043b\u044f <em>CalculatorModule<\/em>, \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043d\u0435\u0434\u0440\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442 <em>Application<\/em>.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0442\u0435\u043c \u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e \u0432 <code>Module<\/code> \u0434\u0432\u0430 <em>Provides-\u043c<\/em>\u0435\u0442\u043e\u0434\u0430, \u043e\u0434\u0438\u043d \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <em>Application<\/em>, \u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u2013 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0438\u0442\u044c <em>StringsProvider<\/em>.<\/p>\n<\/li>\n<li>\n<p>\u042f \u043c\u0435\u043d\u044f\u044e \u043c\u0435\u0442\u043e\u0434, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <em>SumUseCase<\/em>, \u0442.\u043a. \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043d \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 <em>StringProvider<\/em>.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f <em>CalculatorComponent<\/em>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c Dagger, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c <em>CalculatorModule<\/em>.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"kotlin\">@Module class CalculatorModule(     val application: Application ) {      @Provides     @Singleton     fun application(): Application = application      @Provides     @Singleton     fun stringsProvider(         application: Application     ): StringsProvider = StringsProvider(application)      @Provides     @Singleton     fun sumUseCase(         stringsProvider: StringsProvider     ): SumUseCase = SumUseCase(stringsProvider)  }<\/code><\/pre>\n<p><em>CalculatorModule (calculator module)<\/em><\/p>\n<pre><code class=\"kotlin\">class CalculatorActivity : AppCompatActivity() {   ...       override fun onCreate(savedInstanceState: Bundle?) {     ...          DaggerCalculatorComponent.builder()             .calculatorModule(CalculatorModule(application))             .build()             .inject(this)          ...   }      ... }<\/code><\/pre>\n<p><em>CalculatorActivity (calculator module)<\/em><\/p>\n<blockquote>\n<p><em>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 <\/em><a href=\"https:\/\/github.com\/JulianEzequiel\/dagger-multi-module\/commit\/4333aeae118b3edd05eda65b7f749a789943618f\"><em><u>\u044d\u0442\u043e\u043c \u043a\u043e\u043c\u043c\u0438\u0442\u0435<\/u><\/em><\/a><\/p>\n<\/blockquote>\n<h2>\u041f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435 CoreModule?<\/h2>\n<p><em>StringsProvider<\/em> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0438 \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u0430 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f <em>Calculator<\/em>. \u0427\u0430\u0441\u0442\u043e \u0438 \u043c\u043d\u043e\u0433\u043e \u0433\u0434\u0435 \u0431\u044b\u0432\u0430\u0435\u0442 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443, \u0432\u0435\u0440\u043d\u043e?<\/p>\n<p>\u0418\u0442\u0430\u043a, \u043c\u043e\u0436\u0435\u043c \u043b\u0438 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c <em>CoreModule<\/em> \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \u043d\u0435\u0433\u043e <em>StringsProvider<\/em>? \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u0438\u0437\u0431\u0435\u0433\u0430\u0435\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e <em>StringsProvider<\/em>, \u0440\u0435\u0448\u0430\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c:<\/p>\n<ul>\n<li>\n<p>\u041d\u0435 \u0431\u0443\u0434\u0435\u0442 Module \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e<\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-389887","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/389887","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=389887"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/389887\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=389887"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=389887"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=389887"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}