๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๋นˆ ๊ตฌ๋ฉ ์ฑ„์šฐ๊ธฐ

[์‚ฝ์งˆ๊ธฐ๋ก] Kotlinx Serialization์— ์ ‘๊ทผํ•  ์ˆ˜ ์—†์Œ

์ด์Šˆ ๋ฐœ์ƒ

Kotlin Serialization์— ๋„์ €ํžˆ ์ ‘๊ทผํ•  ์ˆ˜ ์—†์—ˆ๋‹ค.

 

์ฝ”๋“œ ์ƒ import kotlinx.serialization ์— ์ ‘๊ทผ ์ž์ฒด๊ฐ€ ๋˜์ง€ ์•Š์•˜๋‹ค.

 

build.gradle ์„ค์ •์„ ํ•˜๋ผ๋Š” ๋Œ€๋กœ ๋‹ค ํ–ˆ๋Š”๋ฐ๋„. 

 

https://blog.stackademic.com/gradle-version-catalogs-for-android-kmp-explained-38a370db0347

 

Android/Kotlin Gradle Version Catalogs Explained

Gradle Version Catalogs are a way to manage versions, dependencies, and plugins in multiple modules.

blog.stackademic.com

์ด ๊ธ€์— ์ •๋ง ์ž˜ ์„ค๋ช…๋˜์–ด ์žˆ๋‹ค.

์ด๋ ‡๊ฒŒ ํ–ˆ๋Š”๋ฐ๋„ ์™œ ์ด๋Ÿฌ๋‚˜ ๋จธ๋ฆฌ ์‹ธ๋งค๊ณ  ๋ฒ„์ „ ์นดํ…Œ๊ณ ๋ฆฌ๋ฅผ ๋ณด๋‹ค๊ฐ€ ์•Œ์•˜๋‹ค.

 

์ด์Šˆ ๋ฐœ์ƒ ์›์ธ

๋ฒ„์ „ ์นดํ…Œ๊ณ ๋ฆฌ์— ์ด๋ ‡๊ฒŒ ์จ ์žˆ์—ˆ๋‹ค.

 

kotlinx-serialization-json = { group = "org.jetbrains.kotlin", name = "kotlinx-serialization-json", version.ref = "kotlinSerialization" }

 

group์— "org.jetbrains.kotlin"์ด๋ผ๊ณ  ์จ ์žˆ์—ˆ๋‹ค.

 

์ด์Šˆ ํ•ด๊ฒฐ

kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinSerialization" }

 

group์— kotlinx๋กœ ๋ณ€๊ฒฝํ•˜๋‹ˆ ์ด์ œ์„œ์•ผ import kotlinx.serialization์— ์ ‘๊ทผ๊ฐ€๋Šฅํ•˜๋‹ค.

 

๋‚˜... ์ € dependency๋ฅผ ์–ด๋Š ๋ธ”๋กœ๊ทธ์—์„œ ๋ณต์‚ฌํ•ด์„œ ๋ถ™์—ฌ๋„ฃ๊ธฐ ํ•œ ๊ฑด๋ฐ... ์ด๋ ‡๊ฒŒ ๋’คํ†ต์ˆ˜ ๋งž์•˜๋‹ค.๐Ÿ™Š

gradle build sync ์‹œ์— kotlinx๋ฅผ kotlin์œผ๋กœ ์จ๋„ฃ์–ด๋„ ์ด์Šˆ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š์•„์„œ ๋ฌธ์ œ๊ฐ€ ์žˆ๋Š”์ง€ ๋ชฐ๋ž๋‹ค.