{"id":2415,"date":"2024-07-18T10:53:49","date_gmt":"2024-07-18T01:53:49","guid":{"rendered":"http:\/\/batmask.dothome.co.kr\/?p=2415"},"modified":"2024-07-18T10:53:49","modified_gmt":"2024-07-18T01:53:49","slug":"%ec%95%88%eb%93%9c%eb%a1%9c%ec%9d%b4%eb%93%9c-%eb%b9%8c%eb%93%9c-%ea%b5%ac%ec%84%b1%ed%95%98%ea%b8%b0-3","status":"publish","type":"post","link":"http:\/\/batmask.net\/index.php\/2024\/07\/18\/2415\/","title":{"rendered":"\uc548\ub4dc\ub85c\uc774\ub4dc \ube4c\ub4dc \uad6c\uc131\ud558\uae30 #3"},"content":{"rendered":"\n<p>Code block Pro \uc790\uafb8 \uc5d0\ub7ec\ub098\uc11c \uc9dc\uc99d\ub098\ub124. \uc5b4\uca54 \uc218 \uc5c6\uc774 \uc0c8\ub85c\uc6b4 \ud3ec\uc2a4\ud2b8\ub85c \ub118\uc5b4\uc634.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Filter variants<\/h4>\n\n\n\n<p>flavor dimension\uc744 \uc0ac\uc6a9\ud558\uba74 \ubaa8\ub4e0 \uc870\ud569\uc744 \uc0ac\uc6a9\ud558\ubbc0\ub85c build variant\uac00 \ub9e4\uc6b0 \ub9ce\uc544\uc9c8 \uc218 \uc788\ub294\ub370, \ud544\uc694\uc5c6\ub294 \uac83\uae4c\uc9c0 \uc0dd\uc131\ub420 \uc218 \uac00 \uc788\ub2e4. \uc774\uacbd\uc6b0, beforeVariants { } \ube14\ub7ed\uc744 \uc774\uc6a9\ud558\uba74 \ub41c\ub2e4. \uc608\uc81c\ub97c \ubcf4\uc790.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"android {\n  ...\n  buildTypes {...}\n\n  flavorDimensions += listOf(&quot;api&quot;, &quot;mode&quot;)\n  productFlavors {\n    create(&quot;demo&quot;) {...}\n    create(&quot;full&quot;) {...}\n    create(&quot;minApi24&quot;) {...}\n    create(&quot;minApi23&quot;) {...}\n    create(&quot;minApi21&quot;) {...}\n  }\n}\n\nandroidComponents {\n    beforeVariants { variantBuilder -&gt;\n        \/\/ To check for a certain build type, use variantBuilder.buildType == &quot;&lt;buildType&gt;&quot;\n        if (variantBuilder.productFlavors.containsAll(listOf(&quot;api&quot; to &quot;minApi21&quot;, &quot;mode&quot; to &quot;demo&quot;))) {\n            \/\/ Gradle ignores any variants that satisfy the conditions above.\n            variantBuilder.enable = false\n        }\n    }\n}\n...\n\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #DCBDFB\">android<\/span><span style=\"color: #ADBAC7\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">  <\/span><span style=\"color: #F47067\">..<\/span><span style=\"color: #ADBAC7\">.<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">  <\/span><span style=\"color: #DCBDFB\">buildTypes<\/span><span style=\"color: #ADBAC7\"> {<\/span><span style=\"color: #F47067\">..<\/span><span style=\"color: #ADBAC7\">.}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">  flavorDimensions <\/span><span style=\"color: #F47067\">+=<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #DCBDFB\">listOf<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&quot;api&quot;<\/span><span style=\"color: #ADBAC7\">, <\/span><span style=\"color: #96D0FF\">&quot;mode&quot;<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">  <\/span><span style=\"color: #DCBDFB\">productFlavors<\/span><span style=\"color: #ADBAC7\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #DCBDFB\">create<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&quot;demo&quot;<\/span><span style=\"color: #ADBAC7\">) {<\/span><span style=\"color: #F47067\">..<\/span><span style=\"color: #ADBAC7\">.}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #DCBDFB\">create<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&quot;full&quot;<\/span><span style=\"color: #ADBAC7\">) {<\/span><span style=\"color: #F47067\">..<\/span><span style=\"color: #ADBAC7\">.}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #DCBDFB\">create<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&quot;minApi24&quot;<\/span><span style=\"color: #ADBAC7\">) {<\/span><span style=\"color: #F47067\">..<\/span><span style=\"color: #ADBAC7\">.}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #DCBDFB\">create<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&quot;minApi23&quot;<\/span><span style=\"color: #ADBAC7\">) {<\/span><span style=\"color: #F47067\">..<\/span><span style=\"color: #ADBAC7\">.}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #DCBDFB\">create<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&quot;minApi21&quot;<\/span><span style=\"color: #ADBAC7\">) {<\/span><span style=\"color: #F47067\">..<\/span><span style=\"color: #ADBAC7\">.}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">  }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #DCBDFB\">androidComponents<\/span><span style=\"color: #ADBAC7\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #DCBDFB\">beforeVariants<\/span><span style=\"color: #ADBAC7\"> { variantBuilder <\/span><span style=\"color: #F47067\">-&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">        <\/span><span style=\"color: #768390\">\/\/ To check for a certain build type, use variantBuilder.buildType == &quot;&lt;buildType&gt;&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">        <\/span><span style=\"color: #F47067\">if<\/span><span style=\"color: #ADBAC7\"> (variantBuilder.productFlavors.<\/span><span style=\"color: #DCBDFB\">containsAll<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #DCBDFB\">listOf<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&quot;api&quot;<\/span><span style=\"color: #ADBAC7\"> to <\/span><span style=\"color: #96D0FF\">&quot;minApi21&quot;<\/span><span style=\"color: #ADBAC7\">, <\/span><span style=\"color: #96D0FF\">&quot;mode&quot;<\/span><span style=\"color: #ADBAC7\"> to <\/span><span style=\"color: #96D0FF\">&quot;demo&quot;<\/span><span style=\"color: #ADBAC7\">))) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">            <\/span><span style=\"color: #768390\">\/\/ Gradle ignores any variants that satisfy the conditions above.<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">            variantBuilder.enable <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #6CB6FF\">false<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">        }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">..<\/span><span style=\"color: #ADBAC7\">.<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\uc704\uc640 \uac19\uc774 \uc791\uc131\ud558\uba74, &#8220;minApi21&#8243;\uc5d0 &#8220;demo&#8221;\ubc84\uc804\uc740 build variant\ub97c \uc0dd\uc131\ud558\uc9c0 \uc54a\uac8c\ub41c\ub2e4.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Source set \ub9cc\ub4e4\uae30<\/h3>\n\n\n\n<p> \uae30\ubcf8\uc801\uc73c\ub85c \uc548\ub4dc\ub85c\uc774\ub4dc \uc2a4\ud29c\ub514\uc624\ub294 main\/ \ub514\ub809\ud1a0\ub9ac\uc758 source set\uc744 \uc0dd\uc131\ud55c\ub2e4. \uc774\uac74 \ubaa8\ub4e0 build variants\ub4e4\uc774 \uacf5\uc720\ud558\uac8c \ub41c\ub2e4. \uc774 \uc678\uc5d0\ub3c4, \uac1c\ubc1c\uc790\uac00 \uc9c1\uc811 build type, product flavor, \ub610\ub294 flavor dimension\uc744 \uc774\uc6a9\ud55c \uc870\ud569\ub4f1 build variant\ub4e4\uc5d0 \ub300\ud574 \ubcc4\ub3c4\uc758 \uc18c\uc2a4 \uc14b\uc744 \uc0dd\uc131\ud560 \uc218 \uc788\ub2e4.<\/p>\n\n\n\n<p>\ubcc4\ub3c4\uc758 source set\uc744 \uc0dd\uc131\ud558\uba74, gradle\uc740 main\/ \uacfc \ub9c8\ucc2c\uac00\uc9c0 \ud615\ud0dc\uc758 \ub514\ub809\ud1a0\ub9ac \uad6c\uc870\ub97c \uac00\uc9c4\ub2e4\uace0 \uac00\uc815\ud55c\ub2e4. \uc608\ub97c\ub4e4\uc5b4 debug\ub97c \ub9cc\ub4e4\uba74, src\/debug\/ \ub85c \uadf8 \ubc11\uc5d0 src\/debug\/kotlin, src\/debug\/java\ub4f1\uc73c\ub85c \ub2e4\ub8ec\ub2e4.<\/p>\n\n\n\n<p>\uc548\ub4dc\ub85c\uc774\ub4dc \uc2a4\ud29c\ub514\uc624\uc758 Gradle \ud0ed\uc5d0\uc11c MyApplication&gt;Tasks&gt;android&gt;sourceSets Task\ub97c \uc2e4\ud589\ud558\uba74 \ub2e4\uc74c\uacfc \uac19\uc740 \ud654\uba74\uc744 build \ud0ed\uc5d0\uc11c \ucc3e\uc544 \ubcfc \uc218 \uc788\ub2e4. task\uac00 \uc548\ubcf4\uc778\ub2e4\uba74, \ub2e4\uc74c \uc124\uc815\uc744 \ud65c\uc131\ud654 \ud574\uc57c \ud55c\ub2e4. File&gt;Settings&gt;Experimental \uc5d0\uc11c Configure all Gradle tasks during Gradle Sync \uc774\uac8c \ud65c\uc131\ud654\ub418\uba74, \ube4c\ub4dc \uc2a4\ud06c\ub9bd\ud2b8 sync\uc2dc\ub9c8\ub2e4 task\ub3c4 \uc7ac\ud615\uc131 \ub418\ub294\uac78\ub85c \ubcf4\uc774\uace0, sync \uc2dc\uac04\uc774 \uae38\uc5b4\uc9c4\ub2e4\uace0 \ud55c\ub2e4. <\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"------------------------------------------------------------\nProject :app\n------------------------------------------------------------\n\n...\n\ndebug\n----\nCompile configuration: debugCompile\nbuild.gradle name: android.sourceSets.debug\nJava sources: [app\/src\/debug\/java]\nKotlin sources: [app\/src\/debug\/kotlin, app\/src\/debug\/java]\nManifest file: app\/src\/debug\/AndroidManifest.xml\nAndroid resources: [app\/src\/debug\/res]\nAssets: [app\/src\/debug\/assets]\nAIDL sources: [app\/src\/debug\/aidl]\nRenderScript sources: [app\/src\/debug\/rs]\nJNI sources: [app\/src\/debug\/jni]\nJNI libraries: [app\/src\/debug\/jniLibs]\nJava-style resources: [app\/src\/debug\/resources]\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F69D50\">------------------------------------------------------------<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F69D50\">Project<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">:app<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F69D50\">------------------------------------------------------------<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #6CB6FF\">...<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #F69D50\">debug<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F69D50\">----<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F69D50\">Compile<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">configuration:<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">debugCompile<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F69D50\">build.gradle<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">name:<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">android.sourceSets.debug<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F69D50\">Java<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">sources:<\/span><span style=\"color: #ADBAC7\"> [app\/src\/debug\/java]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F69D50\">Kotlin<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">sources:<\/span><span style=\"color: #ADBAC7\"> [app\/src\/debug\/kotlin, <\/span><span style=\"color: #96D0FF\">app\/src\/debug\/java]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F69D50\">Manifest<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">file:<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">app\/src\/debug\/AndroidManifest.xml<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F69D50\">Android<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">resources:<\/span><span style=\"color: #ADBAC7\"> [app\/src\/debug\/res]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F69D50\">Assets:<\/span><span style=\"color: #ADBAC7\"> [app\/src\/debug\/assets]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F69D50\">AIDL<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">sources:<\/span><span style=\"color: #ADBAC7\"> [app\/src\/debug\/aidl]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F69D50\">RenderScript<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">sources:<\/span><span style=\"color: #ADBAC7\"> [app\/src\/debug\/rs]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F69D50\">JNI<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">sources:<\/span><span style=\"color: #ADBAC7\"> [app\/src\/debug\/jni]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F69D50\">JNI<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">libraries:<\/span><span style=\"color: #ADBAC7\"> [app\/src\/debug\/jniLibs]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F69D50\">Java-style<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">resources:<\/span><span style=\"color: #ADBAC7\"> [app\/src\/debug\/resources]<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\uc548\ub4dc\ub85c\uc774\ub4dc \uc2a4\ud29c\ub514\uc624\uac00 source set\uc758 \ub514\ub809\ud1a0\ub9ac\ub97c \uc790\ub3d9\uc73c\ub85c \uc0dd\uc131\ud558\uc9c0\ub294 \uc54a\ub294\ub2e4. \ub300\uc2e0, \uc0dd\uc131\uc744 \uc880 \ub3c4\uc640\uc900\ub2e4. \uc548\ub4dc\ub85c\uc774\ub4dc \uc2a4\ud29c\ub514\uc624\uc758 project \ud328\ub110\uc5d0\uc11c Project view\uc778 \uc0c1\ud0dc\ub85c Myproject\/app\/src \ub514\ub809\ud1a0\ub9ac\uc5d0 \uc6b0\ud074\ub9ad&gt;New&gt;Directory \ub97c \uc120\ud0dd\ud558\uba74, \ud31d\uc5c5\uba54\ub274\ub97c \ubcf4\uc5ec\uc8fc\ub294\ub370 \uc5ec\uae30\uc5d0 gradle source set\ub4e4\uc774 \ub9ac\uc2a4\ud2b8\uc5c5\ub41c\ub2e4. \uc5ec\uae30\uc11c debug\/java, debug\/kotlin\ub4f1\uc744 \uc120\ud0dd\ud574\uc8fc\uba74 \ub41c\ub2e4.<\/p>\n\n\n\n<p>\ub2e4\ub978 \ubc29\ubc95\uc73c\ub85c \ud30c\uc77c\uc744 \ucd94\uac00\uc2dc, source set\uc744 \uc120\ud0dd\ud558\uc5ec \ub514\ub809\ud1a0\ub9ac\ub97c \uc0dd\uc131\ud558\ub294 \ubc29\ubc95\ub3c4 \uc788\ub2e4. \uc608\ub97c\ub4e4\uc5b4 Project pane\uc5d0\uc11c src\ub514\ub809\ud1a0\ub9ac\uc5d0 \uc6b0\ud074\ub9ad&gt; New &gt; XML &gt; Values XML File \ub85c xml\ud30c\uc77c\uc744 \ucd94\uac00\ud558\uba74, \ucd94\uac00\ud654\uba74\uc5d0 Target Source Set \ud654\uba74\uc774 \ubcf4\uc778\ub2e4. \uc5ec\uae30\uc11c \uc6d0\ud558\ub294 source set\uc744 \uc120\ud0dd\ud558\uba74 \ub41c\ub2e4.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\uae30\ubcf8 Source set \uc704\uce58\uc124\uc815 \ubc14\uafb8\uae30<\/h4>\n\n\n\n<p>Source set\uc758 \ub514\ub809\ud1a0\ub9ac\uc704\uce58\ub294 \uc548\ub4dc\ub85c\uc774\ub4dc \uc2a4\ud29c\ub514\uc624\uc5d0\uc11c \ub514\ud3f4\ud2b8\ub85c \ub2e4\ub8e8\uac8c \ub418\uc9c0\ub9cc, \ub2e4\ub978 \uc704\uce58\uc5d0 \uc788\ub294\uacbd\uc6b0 \uc0ac\uc6a9\uc790\uac00 \uc784\uc758\ub85c \uc124\uc815\uc774 \uac00\ub2a5\ud558\ub2e4. &#8220;main&#8221; source set \uc5d0 \ub300\ud574 \uc704\uce58\ub97c other\/ \ub85c \uc124\uc815\ud558\uace0 \uc2f6\ub2e4\uba74, \ub2e4\uc74c\uacfc \uac19\uc774 \ubaa8\ub4c8\ub808\ubca8\uc758 gradle \ud30c\uc77c\uc744 \uc791\uc131\ud558\uc5ec \ud560 \uc218 \uc788\ub2e4.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"android {\n  ...\n  \/\/ Encapsulates configurations for the main source set.\n  sourceSets.getByName(&quot;main&quot;) {\n    \/\/ Changes the directory for Java sources. The default directory is\n    \/\/ 'src\/main\/java'.\n    java.setSrcDirs(listOf(&quot;other\/java&quot;))\n\n    \/\/ If you list multiple directories, Gradle uses all of them to collect\n    \/\/ sources. Because Gradle gives these directories equal priority, if\n    \/\/ you define the same resource in more than one directory, you receive an\n    \/\/ error when merging resources. The default directory is 'src\/main\/res'.\n    res.setSrcDirs(listOf(&quot;other\/res1&quot;, &quot;other\/res2&quot;))\n\n    \/\/ Note: Avoid specifying a directory that is a parent to one\n    \/\/ or more other directories you specify. For example, avoid the following:\n    \/\/ res.srcDirs = ['other\/res1', 'other\/res1\/layouts', 'other\/res1\/strings']\n    \/\/ Specify either only the root 'other\/res1' directory or only the\n    \/\/ nested 'other\/res1\/layouts' and 'other\/res1\/strings' directories.\n\n    \/\/ For each source set, you can specify only one Android manifest.\n    \/\/ By default, Android Studio creates a manifest for your main source\n    \/\/ set in the src\/main\/ directory.\n    manifest.srcFile(&quot;other\/AndroidManifest.xml&quot;)\n    ...\n  }\n\n  \/\/ Create additional blocks to configure other source sets.\n  sourceSets.getByName(&quot;androidTest&quot;) {\n      \/\/ If all the files for a source set are located under a single root\n      \/\/ directory, you can specify that directory using the setRoot property.\n      \/\/ When gathering sources for the source set, Gradle looks only in locations\n      \/\/ relative to the root directory you specify. For example, after applying the\n      \/\/ configuration below for the androidTest source set, Gradle looks for Java\n      \/\/ sources only in the src\/tests\/java\/ directory.\n      setRoot(&quot;src\/tests&quot;)\n      ...\n  }\n}\n...\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #DCBDFB\">android<\/span><span style=\"color: #ADBAC7\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">  <\/span><span style=\"color: #F47067\">..<\/span><span style=\"color: #ADBAC7\">.<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">  <\/span><span style=\"color: #768390\">\/\/ Encapsulates configurations for the main source set.<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">  sourceSets.<\/span><span style=\"color: #DCBDFB\">getByName<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&quot;main&quot;<\/span><span style=\"color: #ADBAC7\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #768390\">\/\/ Changes the directory for Java sources. The default directory is<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #768390\">\/\/ &#39;src\/main\/java&#39;.<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    java.<\/span><span style=\"color: #DCBDFB\">setSrcDirs<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #DCBDFB\">listOf<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&quot;other\/java&quot;<\/span><span style=\"color: #ADBAC7\">))<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #768390\">\/\/ If you list multiple directories, Gradle uses all of them to collect<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #768390\">\/\/ sources. Because Gradle gives these directories equal priority, if<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #768390\">\/\/ you define the same resource in more than one directory, you receive an<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #768390\">\/\/ error when merging resources. The default directory is &#39;src\/main\/res&#39;.<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    res.<\/span><span style=\"color: #DCBDFB\">setSrcDirs<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #DCBDFB\">listOf<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&quot;other\/res1&quot;<\/span><span style=\"color: #ADBAC7\">, <\/span><span style=\"color: #96D0FF\">&quot;other\/res2&quot;<\/span><span style=\"color: #ADBAC7\">))<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #768390\">\/\/ Note: Avoid specifying a directory that is a parent to one<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #768390\">\/\/ or more other directories you specify. For example, avoid the following:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #768390\">\/\/ res.srcDirs = [&#39;other\/res1&#39;, &#39;other\/res1\/layouts&#39;, &#39;other\/res1\/strings&#39;]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #768390\">\/\/ Specify either only the root &#39;other\/res1&#39; directory or only the<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #768390\">\/\/ nested &#39;other\/res1\/layouts&#39; and &#39;other\/res1\/strings&#39; directories.<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #768390\">\/\/ For each source set, you can specify only one Android manifest.<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #768390\">\/\/ By default, Android Studio creates a manifest for your main source<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #768390\">\/\/ set in the src\/main\/ directory.<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    manifest.<\/span><span style=\"color: #DCBDFB\">srcFile<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&quot;other\/AndroidManifest.xml&quot;<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">..<\/span><span style=\"color: #ADBAC7\">.<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">  }<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">  <\/span><span style=\"color: #768390\">\/\/ Create additional blocks to configure other source sets.<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">  sourceSets.<\/span><span style=\"color: #DCBDFB\">getByName<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&quot;androidTest&quot;<\/span><span style=\"color: #ADBAC7\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">      <\/span><span style=\"color: #768390\">\/\/ If all the files for a source set are located under a single root<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">      <\/span><span style=\"color: #768390\">\/\/ directory, you can specify that directory using the setRoot property.<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">      <\/span><span style=\"color: #768390\">\/\/ When gathering sources for the source set, Gradle looks only in locations<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">      <\/span><span style=\"color: #768390\">\/\/ relative to the root directory you specify. For example, after applying the<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">      <\/span><span style=\"color: #768390\">\/\/ configuration below for the androidTest source set, Gradle looks for Java<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">      <\/span><span style=\"color: #768390\">\/\/ sources only in the src\/tests\/java\/ directory.<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">      <\/span><span style=\"color: #DCBDFB\">setRoot<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&quot;src\/tests&quot;<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">      <\/span><span style=\"color: #F47067\">..<\/span><span style=\"color: #ADBAC7\">.<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">  }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">..<\/span><span style=\"color: #ADBAC7\">.<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">Source set \uc73c\ub85c \ube4c\ub4dc\ud558\uae30<\/h4>\n\n\n\n<p> product flavor \uac00 &#8220;demo&#8221; \uc774\uace0, build type\uc774 &#8220;debug&#8221;\uc778 build variant &#8220;demoDebug&#8221;\ub97c \ube4c\ub4dc\ud558\uac8c \ub418\uba74, Gradle\uc740 \ub2e4\uc74c \uc21c\uc11c\ub85c source set\uc744 \ucc3e\uac8c \ub41c\ub2e4.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><mark style=\"background-color:#8ed1fc\" class=\"has-inline-color has-black-color\">src\/demoDebug\/ <\/mark> : build variant source set<\/li>\n\n\n\n<li><mark style=\"background-color:#8ed1fc\" class=\"has-inline-color\">src\/debug\/<\/mark> : build type source set<\/li>\n\n\n\n<li><mark style=\"background-color:#8ed1fc\" class=\"has-inline-color\">src\/demo\/<\/mark> : product flavor source set<\/li>\n\n\n\n<li><mark style=\"background-color:#8ed1fc\" class=\"has-inline-color\">src\/main\/<\/mark> : default main source set<\/li>\n<\/ol>\n\n\n\n<p>\ub9cc\uc57d, \uc5ec\ub7ec\uac1c\uc758 product flavor\ub97c \uacb0\ud569\ud55c\ub2e4\uba74, \uae30\uc220\ub41c flavor dimension\ub4e4\uc758 \uc21c\uc11c\uc5d0 \ub530\ub77c \uc6b0\uc120\uc21c\uc704\ub97c \uac16\uac8c\ub41c\ub2e4. <\/p>\n\n\n\n<p>\uc870\uae08 \ud63c\ub780\uc2a4\ub7ec\uc6b4 \ubd80\ubd84\uc740 \uc774 \uc6b0\uc120\uc21c\uc704\ub85c \ubb34\uc870\uac74 \ub36e\uc5b4\uc4f0\uae30\uac00 \ub418\ub294\uac8c \uc544\ub2c8\ub77c\ub294 \uac83 \uac19\ub2e4. kotlin\/ java\/ \uc544\ub798\uc758 \uc18c\uc2a4\ub4e4\uc740 \ubaa8\ub450 \ud55c\uaebc\ubc88\uc5d0 \ucef4\ud30c\uc77c \ub418\uba70, main\/ \uc5d0 \uc788\ub294 \uac83\uacfc \ub3d9\uc77c\ud55c \ud074\ub798\uc2a4\uba85\uc744 \ub2e4\ub978 \uacf3, \uc608\ub97c\ub4e4\uc5b4 debug\/ \uc5d0\uc11c \uc0ac\uc6a9\ud560 \uc218 \uc5c6\ub2e4\uace0 \ud55c\ub2e4.(\ucef4\ud30c\uc77c \uc5d0\ub7ec) \uc544\ub9c8\ub3c4 \ucf54\ub4dc\ub294 \ub36e\uc5b4\uc4f0\ub294\uac8c \uc544\ub2c8\ub77c \ucd94\uac00\ud558\ub294 \uac1c\ub150\uc778\uac78\ub85c \ubcf4\uc784.<\/p>\n\n\n\n<p>Manifest, values\/, res\/, asset\/ \ub4f1\uc740 merge\uac00 \ub418\ub294\ub370, \uac19\uc740 \uc774\ub984\uc758 \ub9ac\uc18c\uc2a4\uac00 \uc874\uc7ac\ud55c\ub2e4\uba74 \uc704\uc758 \uc6b0\uc120\uc21c\uc704\uac00 \ub192\uc740 \uac83\uc774 \uc120\ud0dd\ub418\ub294 \uac83\uc73c\ub85c \ubcf4\uc778\ub2e4.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Code block Pro \uc790\uafb8 \uc5d0\ub7ec\ub098\uc11c \uc9dc\uc99d\ub098\ub124. \uc5b4\uca54 \uc218 \uc5c6\uc774 \uc0c8\ub85c\uc6b4 \ud3ec\uc2a4\ud2b8\ub85c \ub118\uc5b4\uc634. Filter variants flavor dimension\uc744 \uc0ac\uc6a9\ud558\uba74 \ubaa8\ub4e0 \uc870\ud569\uc744 \uc0ac\uc6a9\ud558\ubbc0\ub85c build variant\uac00 \ub9e4\uc6b0 \ub9ce\uc544\uc9c8 \uc218 \uc788\ub294\ub370, \ud544\uc694\uc5c6\ub294 \uac83\uae4c\uc9c0 \uc0dd\uc131\ub420 \uc218 \uac00 \uc788\ub2e4. \uc774\uacbd\uc6b0, beforeVariants { } \ube14\ub7ed\uc744 \uc774\uc6a9\ud558\uba74 \ub41c\ub2e4. \uc608\uc81c\ub97c \ubcf4\uc790. \uc704\uc640 \uac19\uc774 \uc791\uc131\ud558\uba74, &#8220;minApi21&#8243;\uc5d0 &#8220;demo&#8221;\ubc84\uc804\uc740 build variant\ub97c \uc0dd\uc131\ud558\uc9c0 \uc54a\uac8c\ub41c\ub2e4. Source set \ub9cc\ub4e4\uae30 \uae30\ubcf8\uc801\uc73c\ub85c \uc548\ub4dc\ub85c\uc774\ub4dc [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,34],"tags":[186,394,399,395,38,396,397,20,41],"class_list":["post-2415","post","type-post","status-publish","format-standard","hentry","category-android","category-kotlin","tag-android-2","tag-build","tag-build-script","tag-build-gradle-kts","tag-kotlin","tag-396","tag-397","tag-android","tag-kotlin-kr"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/posts\/2415","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/comments?post=2415"}],"version-history":[{"count":29,"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/posts\/2415\/revisions"}],"predecessor-version":[{"id":2446,"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/posts\/2415\/revisions\/2446"}],"wp:attachment":[{"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/media?parent=2415"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/categories?post=2415"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/tags?post=2415"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}