๐Ÿ“† 23.03.23 - ๋Œ€์ถฉ React-Native Cli ๋ง›๋ณด๋˜ ๋‚ด์šฉ

๋ฒ„๋“คยท2023๋…„ 3์›” 23์ผ
1

โœจToday I Learn (TIL)

๋ชฉ๋ก ๋ณด๊ธฐ
32/62
post-thumbnail
post-custom-banner

์›๋ž˜ ๊ฐ™์•˜์œผ๋ฉด ์ด์ „ ํฌ์ŠคํŠธ ๋‹ค์Œ์œผ๋กœ ๋ฐ”๋กœ ์„ฑ๋Šฅ ๊ฐœ์„ ์— ๊ด€ํ•œ ์ด์•ผ๊ธฐ๋ฅผ ๋‹ค๋ฃจ๋ ค๊ณ  ํ–ˆ๋Š”๋ฐ, ์–ด๋– ํ•œ ๊ธฐ์—…์—์„œ RN์œผ๋กœ ์‹ค์‹œ๊ฐ„ ๊ณผ์ œ๋ฅผ ๋ณธ๋‹ค๊ณ  ํ•ด์„œ ํ˜ธ๋‹ค๋‹ฅ ๊ณต๋ถ€ํ•ด ๋ด์•ผ๋˜๊ธฐ์— ๋‹ค์Œ์œผ๋กœ ๋ฏธ๋ฃจ๊ฒ ์Šต๋‹ˆ๋‹ค ; (

์œ„์—์„œ ์งง๊ฒŒ ๋งํ–ˆ๋“ฏ์ด ์˜ค๋Š˜์€ ์ฒ˜์Œ์œผ๋กœ ๋ง›๋ณด๋Š” React Native ์ดˆ๊ธฐ ์„ค์ •์— ๊ด€ํ•ด์„œ ๊ฒช์—ˆ๋˜ ์ด์•ผ๊ธฐ๋ฅผ ์จ๋‚ด๋ ค๊ฐ€๋ ค๊ณ  ํ•œ๋‹ค.


React Native

React Native๋ž€

React๋กœ ์–ดํ”Œ์„ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋Š” ํ”„๋ ˆ์ž„์›Œํฌ์ด๋‹ค. ์•ˆ๋“œ๋กœ์ด๋“œ์˜ Kotiln, IOS์˜ Swift ์ฒ˜๋Ÿผ ์•ฑ์„ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋Š”๋ฐ, ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ํ™˜๊ฒฝ์œผ๋กœ ๋‘ ๊ธฐ์ข… ๋ชจ๋‘ ๊ตฌ๋™ ๊ฐ€๋Šฅํ•˜๊ฒŒ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋‹ค๋Š” ๊ฒƒ์ด ํฐ ์žฅ์ ์ธ๋“ฏ ํ•˜๋‹ค.

react์—์„œ ์ผ๋˜ ๊ฒƒ ์ฒ˜๋Ÿผ ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ๋„ ์ ์šฉํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์Šคํƒ€์ผ๋“œ ์ปดํฌ๋„ŒํŠธ๋กœ CSS ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•  ์ˆ˜๋„ ์žˆ๋‹ค.

๋…ธ๋งˆ๋“œ ์ฝ”๋” ์™ˆ,
React๋ฅผ ํ•  ์ค„ ์•ˆ๋‹ค๋ฉด? ๊ทธ๊ฒƒ๋„ useState, useEffect ์ •๋„๋งŒ ์ž˜ ์“ฐ๋ฉด 3%์˜ ์ถ”๊ฐ€ ์ง€์‹๋งŒ ๋ฐฐ์šฐ๋ฉด ๋œ๋‹ค. ๋ผ๊ณ  ํ•˜๋”๋ผ

์ด๋ฒˆ ํฌ์ŠคํŠธ์—์„œ React Native์˜ ๊ตฌ์กฐ๋ฅผ ๋‹ค๋ฃจ๊ธฐ๋ณด๋‹ค๋Š” ์„ค์น˜ ํ™˜๊ฒฝ์„ ์กฐ์„ฑํ•˜๋ฉด์„œ, ๋Š๋‚€ ๊นŠ์€ ๋นก์นจ๐Ÿคฌ์„ ๋‹ค๋ฃจ๋ ค๊ณ  ํ•˜๋ฉฐ, ๋‚˜์™€ ๊ฐ™์€ ํ”ผํ•ด์ž ๋ถ„๋“ค์ด ๋ฐœ์ƒํ•˜์ง€ ์•Š๊ฒŒ ์กฐ๊ธˆ์ด๋‚˜๋งˆ ํž˜์„ ๋ณดํƒœ๋ ค๊ณ  ํ•œ๋‹ค.

๋ณธ ํŽธ์œผ๋กœ ๋„˜์–ด๊ฐ€๊ธฐ ์ „์— ๊ฐœ๋ฐœํ™˜๊ฒฝ์„ ๊ตฌ์„ฑํ•˜๋Š”๋ฐ์— ์žˆ์–ด ์•Œ์•„์•ผ๋˜๋Š” ๊ฐ„๋‹จํ•œ ์„ค๋ช…์„ ๋จผ์ € ํ•˜๋ ค๊ณ  ํ•œ๋‹ค.


Expo / React Native Cli

React ๊ธฐ๋ฐ˜์ด๊ธด ํ•˜์ง€๋งŒ, ์‚ฌ์‹ค์ƒ ์›น์•ฑ๋ณด๋‹ค๋Š” ์•ฑ์— ๋Œ€ํ•œ ์„ฑํ–ฅ์ด ํ™•๊ณ ํ•˜๊ธฐ๋„ ํ•˜๊ณ , ๋‹ค๋ฅธ OS๋“ค ๋ผ๋ฆฌ ํ˜ธํ™˜์„ ์œ„ํ•ด Build ๋œ ํ”„๋กœ์ ํŠธ๋Š” JAVA ๊ธฐ๋ฐ˜์ด๋‹ค. ์•„, ๋ฌผ๋ก  ์šฐ๋ฆฌ๊ฐ€ ์ž‘์„ฑํ•˜๋Š” ์ฝ”๋“œ๋Š” ๋ฌผ๋ก  JS ํ˜น์€ TS ์ด๋‹ค.

์œ„์˜ ์‚ฌ์ง„์€ RN ํ”„๋กœ์ ํŠธ๋ฅผ ๋งŒ๋“ค๊ณ  ์ฒ˜์Œ์œผ๋กœ Github์— ์˜ฌ๋ฆฐ Repo์˜ ๊ธฐ์ˆ  ์Šคํƒ ๋ถ„ํฌํ‘œ๋‹ค.
JAVA.. ๋ผ๋Š” ์ฃผํ™ฉ์ƒ‰ ์นœ๊ตฌ๊ฐ€ 43.9%๋ฅผ ์ฐจ์ง€ํ•˜๊ณ  ์žˆ๋Š” ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ๋Š”๋ฐ, ์ด๊ฒƒ๋•Œ๋ฌธ์— ์ผ๋ฐ˜์ ์œผ๋กœ JS ์„ธํŒ…ํ•˜๋Š” ๊ฒƒ๋ณด๋‹ค ์ดˆ๋ฒŒ์„ ํ•œ๋ฒˆ ๊ฑฐ์ณ์ค˜์•ผ๋œ๋‹ค.

React Native ๊ฐ€ JS ์—์„œ App๊นŒ์ง€ ๋˜๊ฐ€๋Š” ๊ณผ์ •

์œ„์˜ ์‚ฌ์ง„์„ ๋ณด๋ฉด APK, IPA ๊ฐ™์€ native app์€ ๊ฐ๊ฐ Swift & Objective-C , java & C/C++ (Kotlin) ์œผ๋กœ ์ด๋ฃจ์–ด์ ธ์žˆ๋‹ค๋Š” ๊ฒƒ์„ ์•Œ ์ˆ˜ ์žˆ๋‹ค.

๊ทธ๋Ÿฐ๋ฐ ์šฐ๋ฆฌ๊ฐ™์ด ์ž๋ฐ”๋ž‘ ์‚ด์ง ๊ฑฐ๋ฆฌ๊ฐ€ ๋จผ ํ”„๋ก ํŠธ์—”๋“œ ๊ฐœ๋ฐœ์ž๋“ค์ด ์‰ฝ๊ฒŒ ์•ฑ์„ ๊ฐœ๋ฐœํ•  ์ˆ˜ ์žˆ๊ฒŒ JS ์ฝ”๋“œ์™€ CSS ์ฝ”๋“œ ๋“ฑ์œผ๋กœ ๊ตฌ์กฐ๋ฅผ ์„ค๊ณ„ํ•ด ๋†“์œผ๋ฉด Bridge ์—ญํ• ์„ RN ๋‚ด์—์„œ ๊ธฐ๋Šฅํ•˜์—ฌ ์ถ”ํ›„์— ๋นŒ๋“œ ๋“ฑ์˜ ์ผ๋ จ์˜ ์ž‘์—…์„ ๊ฑฐ์น˜๋ฉด ํ•ด๋‹น ๊ธฐ๋Šฅ๋“ค์„ ๊ฐ OS์— ์ตœ์ ํ™” ๋˜์–ด์žˆ๋Š” ์ฝ”๋“œ๋กœ ๋ณ€ํ™˜์„ ํ•ด์ค€๋‹ค๋Š” ์ด์•ผ๊ธฐ์ด๋‹ค.

๊ทธ๋Ÿฐ๋ฐ ์šฐ๋ฆฌ๊ฐ€ ๊ทธ๋ƒฅ ํ”ํžˆ ์“ฐ๋˜ VSCode ๋กœ ์ž‘์—…ํ•˜๋ฉด ์•Œ์•„์„œ ํ•ด์ฃผ๋Š๋ƒ.. ๊ทธ๊ฒƒ์€ ์•„๋‹ˆ๋‹ค.
ํ•„์š”ํ•œ ๋‚ด๋ถ€ ํŒจํ‚ค์ง€ ๋“ฑ์€ ๊ธฐ์กด์— ์–ดํ”Œ์„ ๋งŒ๋“œ๋Š”๋ฐ ์‚ฌ์šฉํ•˜๋˜ Tool์„ ์ด์šฉ์„ ํ•ด์•ผ ํ™˜๊ฒฝ์„ ์กฐ์„ฑํ•  ์ˆ˜ ์žˆ๋‹ค. IOS๋Š” Xcode, ์•ˆ๋“œ๋กœ์ด๋“œ๋Š” Android Studio ์—์„œ ๊ฐ€๋Šฅํ•˜๋‹ค.


์•„๋ฌดํŠผ.. ๋‹ค์‹œ ์ด ๋ณธ๋ฌธ์˜ ์ฃผ์š” ๋‚ด์šฉ์œผ๋กœ ๋„˜์–ด๊ฐ€์„œ React Native ๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๋ฐฉ๋ฒ•์—๋Š” ํฌ๊ฒŒ 2๊ฐœ๊ฐ€ ์žˆ๋‹ค.

  • Expo
  • React Native Cli

์ผ๋‹จ ์ด๋ฆ„์ด React Native Cli ์ด๋‹ˆ๊นŒ ์ด๊ฒŒ ์ฐ ์•„๋‹Œ๊ฐ€์š”? ๋ผ๊ณ  ํ•  ์ˆ˜๋„ ์žˆ๋Š”๋ฐ React Native ๊ณต์‹ ํ™ˆํŽ˜์ด์ง€์˜ ์„ค์น˜๊ด€๋ จ ๋ถ€๋ถ„ ์„ ๋ณด๋ฉด Expo๊ฐ€ ๋งจ์ฒ˜์Œ์œผ๋กœ ๋‚˜์™€์žˆ๋‹ค.

์ด๋ฒˆ ์ผ๋ จ์˜ ๊ฒฝํ—˜์„ ๊ฒช์Œ์œผ๋กœ์จ Expo๊ฐ€ ๋งจ์ฒ˜์Œ์œผ๋กœ ์–ธ๊ธ‰๋œ๋ฐ์—๋Š” ํŽธ์˜์„ฑ ์˜ ์žฅ์ ์ด ํฌ๊ธฐ์— ๊ทธ๋ ‡๊ฒŒ ํ•ด๋†“์€ ๊ฒƒ ๊ฐ™๋‹ค๋Š” ์ƒ๊ฐ์ด ๋“ ๋‹ค.

Expo

Expo CLI๋Š” React Native๋กœ ์–ดํ”Œ์„ ๋งŒ๋“œ๋ ค๋Š” ๊ฐœ๋ฐœ์ž๋“ค์—๊ฒŒ ํŽธ๋ฆฌํ•จ์„ ์ตœ์šฐ์„ ์œผ๋กœ ์ œ๊ณตํ•ด์ค€๋‹ค. ์ด ํˆด์˜ ํฐ ์žฅ์ ์ด๋ผ๊ณ  ๋งํ•  ์ˆ˜ ์žˆ๋Š”๋ฐ, ์™œ ๊ทธ๋Ÿฌ๋ƒ..! ์šฐ๋ฆฌ๊ฐ€ JS ์ฝ”๋“œ๋ฅผ ์งค ๋•Œ ์‚ฌ์šฉํ•˜๋˜ VScode๋‚˜ ์ธํ…”๋ฆฌ์ œ์ด์—์„œ ์ž‘์—…์„ ์ค€๋น„ํ•˜๋Š” ๊ฒƒ๊ณผ ํฌ๊ฒŒ ์ฐจ์ด๋‚˜์ง€ ์•Š์€ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์„ ๊ตฌ์ถ•ํ•  ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค.

๋˜ํ•œ, ์•ˆ๋“œ๋กœ์ด๋“œ ๊ฐ™์€ ๊ฒฝ์šฐ์—๋Š” ์•ˆ๋“œ๋กœ์ด๋“œ ์ŠคํŠœ๋””์˜ค๋ฅผ ํ†ตํ•ด์„œ๋งŒ ๊ฐœ๋ฐœ ์„œ๋ฒ„๋ฅผ ์—ด์–ด ์ž‘์—…๋ฌผ์ด ์–ด๋–ป๊ฒŒ ๊ตฌํ˜„๋˜๊ณ  ์žˆ๋Š”์ง€ ํ™•์ธ์„ ํ•  ์ˆ˜ ์žˆ๋Š”๋ฐ, Expo ์•ฑ์„ ์ž์‹  ํฐ์— ๊น”์•„์ฃผ๋ฉด ์—ฐ๋™๋˜์–ด ์‹ค์‹œ๊ฐ„์œผ๋กœ ํ™•์ธ์ด ๊ฐ€๋Šฅํ•˜๋‹ค.

์ด๋Ÿฌํ•œ ์žฅ์ ๋“ค๋กœ ์ธํ•ด ๊ฐœ๋ฐœํ™˜๊ฒฝ์„ ๊ตฌ์„ฑํ•˜๋Š”๋ฐ ์žˆ์–ด ํฐ ์–ด๋ ค์›€ ์—†์ด ์ง„ํ–‰ํ•˜๊ณ  ๊ฐœ๋ฐœํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋œ๋‹ค.

๋ฌผ๋ก  ๋‹จ์ ๋„ ์žˆ๋‹ค.

  • Java, Kotlin, Object-C, Swift๋ฅผ ์ถ”๊ฐ€์ ์œผ๋กœ ์ž‘์„ฑ์ด ๋ถˆ๊ฐ€๋Šฅํ•˜๋‹ค. ์ฆ‰ native ํŒŒ์ผ ์ œ์–ด๊ฐ€ ๋ถˆ๊ฐ€๋Šฅํ•˜๋‹ค
  • Expo์—์„œ ์ œ๊ณตํ•˜๋Š” ๊ธฐ๋Šฅ๋“ค๋งŒ ํ™œ์šฉ ๊ฐ€๋Šฅํ•˜๋‹ค.

๊ทธ๋ฆฌ๊ณ  ์‚ฌ๋žŒ๋“ค์ด RN client๋ฅผ ๋งŽ์ด ์“ฐ๋Š” ๊ฐ€์žฅ ํฐ ์ด์œ ์ธ ๊ฐœ๋ฐœ์„ ํ•  ๋•Œ ์ž์œ ๋„๊ฐ€ ๋–จ์–ด์ง„๋‹ค ์˜ ๋‹จ์ ์„ ์ง€๋‹ˆ๊ณ  ์žˆ๋‹ค.

๊ทธ๋Ÿฌ๋ฏ€๋กœ Expo๋Š” ๊ทœ๋ชจ๊ฐ€ ์ ์œผ๋ฉฐ, ๋น ๋ฅธ ๊ฐœ๋ฐœํ™˜๊ฒฝ์„ ๊ตฌ์ถ•ํ•  ๋•Œ ์šฉ์ดํ•˜๊ฒŒ ์‚ฌ์šฉ๋œ๋‹ค.

React Native Cli

react ๋ฐ react native๋ฅผ ๊ฐœ๋ฐœํ•œ ๋ฉ”ํƒ€์˜ ๊ณต์‹์ ์ธ ์„ค์น˜ ํˆด์ด๋‹ค. ์™ธ๋ถ€ ํˆด์ธ Expo์™€ ๋‹ค๋ฅด๊ฒŒ ๊ณต์‹๋งˆํฌ๊ฐ€ ๋ฐ•ํžŒ ์š” ๋…€์„์€ ๊ฐœ๋ฐœ์˜ ์ž์œ ๋„๊ฐ€ ๋„“์œผ๋ฉฐ, ์ด๋ฏธ ์กด์žฌํ•˜๊ณ  ์žˆ๋Š” RN Cli๋กœ ๋งŒ๋“  ๋ ˆํผ๋Ÿฐ์Šค๋ฅผ ์ฐธ๊ณ ํ•˜๊ธฐ ์šฉ์ดํ•˜๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์ถ”ํ›„์— JAVA ํŒŒ์ผ์— ์†์„ ๋Œ€์•ผ๋œ๋‹ค๋ฉด, Expo์™€ ๋‹ค๋ฅด๊ฒŒ ์ œ์–ด๊ฐ€ ๊ฐ€๋Šฅํ•˜๋‹ค.

๊ทธ๋ฆฌ๊ณ  ๋‹จ์ ์€ ๊ฐœ๋ฐœํ™˜๊ฒฝ ๊ตฌ์ถ•์ธ๋ฐ ์™œ ๊ทธ๋Ÿฐ์ง€ ๋‚ด๊ฐ€ ๊ทผ 2์ผ๊ฐ„ ๊ฒช์€ ์ƒํ™ฉ์„ ๋‚˜์—ดํ•˜๋ฉฐ ์„ค๋ช…ํ•˜๋„๋ก ํ•˜๊ฒ ๋‹ค.

์—๋Ÿฌ ๋ฐœ์ƒ (React Native Cli ๊ฐœ๋ฐœํ™˜๊ฒฝ ๊ตฌ์„ฑ)

์•ž์„œ ๋งํ–ˆ๋“ฏ์ด React Native Cli๋Š” Android Studio์—์„œ ์„ค์ •์„ 8ํ•  ์ด์ƒ ๊ตฌ์„ฑํ•ด์•ผ๋œ๋‹ค.
์ž์„ธํ•œ ๊ฐœ๋ฐœํ™˜๊ฒฝ์„ ์กฐ์„ฑํ•˜๋Š” ๊ฒƒ์€ ์•„๋ž˜์˜ ์–ธ๊ธ‰์„ ํ™œ์šฉํ•˜๊ธธ ๋ฐ”๋ž€๋‹ค.
์ •๋ง ์–ด๋ ค์›Œ์„œ ์—ฌ๋Ÿฌ ๋ธ”๋กœ๊ทธ, ์งˆ๋ฌธ๊ธ€ ๋“ฑ์„ ํ™œ์šฉํ–ˆ๊ธฐ์— ๋‚œ์žกํ•  ์ˆ˜๋„ ์žˆ๋‹ค.. ใ… 

๐Ÿ’ก์ฐธ๊ณ ํ•ด๋ณด์„ธ์š”
1. ๊ตญ๋ฐฅ : React Native ๊ณต์‹ ํ™ˆํŽ˜์ด์ง€
2. ๋ฐ˜์ฐฌ (๊น€์น˜) : ์•ˆ๋“œ๋กœ์ด๋“œ ์ŠคํŠœ๋””์˜ค ๋ฐ ํ™˜๊ฒฝ๋ณ€์ˆ˜ ์„ค์ •
3. ํ•„์ˆ˜ ๋ถ€์žฌ๋ฃŒ (๋‹ค๋Œ€๊ธฐ ๊ฐ™์€ ์กด์žฌ) : Java 11 ๋ฒ„์ „ ์„ค์น˜
4. ๊ฐ™์ด ๊ณ๋“ค์—ฌ ๋จน์œผ๋ฉด ์ •๋ง ๋„์›€์ด ๋˜๋Š” ๋ธ”๋กœ๊ทธ


๊ธฐ์กด ๋ฃจํŠธ์— ํ•œ๊ธ€์˜ ํด๋”๊ฐ€ ์„ž์ธ ํ”„๋กœ์ ํŠธ

์ƒ๋‹จ์˜ ๊ธ€๋“ค์„ ์ฐธ๊ณ ํ•˜์—ฌ react native cli๋ฅผ ์„ค์น˜ ํ›„, sdk (ํ˜„์žฌ 13๋ฒ„์ ผ์˜ ํ‹ฐ๋ผ๋ฏธ์ˆ˜) ๋ฐ ํ™˜๊ฒฝ๋ณ€์ˆ˜ ์„ค์ •์„ ๋ชจ๋‘ ๋งˆ์น˜๊ณ , npm run start -> a ํ‚ค๋กœ ์•ˆ๋“œ๋กœ์ด๋“œ ํ™˜๊ฒฝ์„ ์—ด์–ด์ฃผ์—ˆ๋‹ค.
๊ทธ๋Ÿฌ์ž ๋นŒ๋“œ ์—๋Ÿฌ๋ฅผ ๋งˆ์ฃผํ•˜๊ฒŒ ๋˜๋Š”๋ฐ..

BUILD FAILED in 3s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
:ReactNative:Unexpected empty result of running '[node, C:\Users\๋ฒ„๋“ค?๏ฟฝ๏ฟฝ\Documents\Project\AwesomeProject\node_modules\@react-native-community\cli\build\bin.js, config]' command.
:ReactNative:Running '[node, C:\Users\๋ฒ„๋“ค?๏ฟฝ๏ฟฝ\Documents\Project\AwesomeProject\node_modules\@react-native-community\cli\build\bin.js, config]' command failed.

์ฒ˜์Œ์— ์—๋Ÿฌ ๋‚ด์šฉ์„ ๋ฌด์–ธ๊ฐ€ Config ํŒŒ์ผ์ด ์ž˜๋ชป ๋˜์–ด ๋นŒ๋“œ๊ฐ€ ์•ˆ๋œ ๊ฒƒ์ด๋ผ ์ƒ๊ฐํ–ˆ์—ˆ๋‹ค.
ํ•˜์ง€๋งŒ ์—ฌ๋Ÿฌ ๊ธ€๋“ค์„ ๋น„๊ตํ•ด๋ณธ ๊ฒฐ๊ณผ, ๋ฐ”๋กœ npx react-native@latest init ํ”„๋กœ์ ํŠธ๋ช… ์œผ๋กœ ๋งŒ๋“ค์–ด๋‚ธ ์งํ›„๋ผ์„œ ์›์ธ์ด ์•„๋‹Œ๊ฒƒ์œผ๋กœ ํŒ๋ช…๋‚ฌ๋‹ค.

๊ทธ๋ฆฌ๊ณ  ์•Œ์•„๋‚ธ ๋‹ค๋ฅธ ๊ฐ€๋Šฅ์„ฑ์€ ๋ฐ”๋กœ ํ”„๋กœ์ ํŠธ ๊ฒฝ๋กœ์— ํ•œ๊ธ€์ด ๋“ค์–ด๊ฐ„ ๊ฒƒ์ด๋‹ค.
๋‚ด ์œˆ๋„์šฐ user name์€ ํ•œ๊ธ€๋กœ ๋˜์–ด์žˆ์œผ๋ฉฐ, ํ”„๋กœ์ ํŠธ๋“ค์„ ๋‚ด ๋ฌธ์„œ์—์„œ ๋ชจ์•„๋‘๊ณ  ์žˆ์—ˆ๊ธฐ์—, ์ด ๊ฒฝ๋กœ ๋˜ํ•œ ํ•œ๊ธ€๋กœ ๋œ ์ด๋ฆ„\document\projects๋กœ ์ด๋ฃจ์–ด์ ธ ์žˆ์„ ์ˆ˜ ๋ฐ–์— ์—†๋‹ค.

React Native๋ฅผ ์‹คํ–‰ํ•  ๋•Œ๋Š” ๊ฒฝ๋กœ์— ํ•œ๊ธ€์ด ์žˆ์œผ๋ฉด ์•ˆ๋œ๋‹ค๊ณ  ํ•œ๋‹ค. ๋”ฐ๋ผ์„œ ๊ฒฝ๋กœ๋ฅผ ๋‹ค์‹œ ์ง€์ •ํ•˜์—ฌ ํ”„๋กœ์ ํŠธ๋ฅผ ์„ค์น˜ ํ›„ ์‹คํ–‰ํ•˜์˜€๋”๋‹ˆ, ํ•ด๋‹น ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ์—ˆ๋‹ค.๐Ÿค“

๋ฒ„์ „ ๊ด€๋ จ ์—๋Ÿฌ ๋ฐœ์ƒ

๋‹ค์‹œ ํด๋ผ์ด์–ธํŠธ ์„œ๋ฒ„๋ฅผ ์‹คํ–‰ํ•˜๋‹ˆ ๋˜ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค.

FAILURE: Build failed with an exception.

* Where:
Build file 'D:\RN\android\app\build.gradle' line: 1 

* What went wrong:
A problem occurred evaluating project ':app'.       
> Failed to apply plugin 'com.android.internal.application'.
   > Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
      Your current JDK is located in C:\Program Files\Java\jdk1.8.0_211\jre
      You can try some of the following options:    
       - changing the IDE settings.
       - changing the JAVA_HOME environment variable.
       - changing `org.gradle.java.home` in `gradle.properties`.

๋ฌธ์ œ์˜ ์—๋Ÿฌ ์ฝ”๋“œ๋Š” ์ด๋Ÿฌํ•˜๋‹ค.

์ฒ˜์Œ์— ๋‚˜๋Š” SDK๊ฐ€ ์ž˜ ์ธ์‹์ด ๋˜์ง€ ์•Š์•„ ๋ฐœ์ƒํ•œ ๋ฌธ์ œ๋ผ ์ƒ๊ฐํ•˜๊ณ  ๋ช‡ ์‹œ๊ฐ„์˜ ์‚ฝ์งˆ์„ ํ•˜๊ฒŒ ๋˜์—ˆ๋Š”๋ฐ..

  • SDK ์žฌ์„ค์น˜
  • ์•ˆ๋“œ๋กœ์ด๋“œ ์ŠคํŠœ๋””์˜ค ์žฌ์„ค์น˜ ๋ฐ ํ™˜๊ฒฝ์„ค์ • ์žฌ์„ค์ •
    ๋“ฑ๋“ฑ..

์œ„์—์ฒ˜๋Ÿผ Sdk๋ผ๋Š” ํด๋”๋„ ๋”ฐ๋กœ ์ƒ์„ฑํ•ด์ฃผ๊ณ  ์—ฌ๊ธฐ์— ํ™˜๊ฒฝ ๋ณ€์ˆ˜๋„ ๋‹ค ์—ฐ๊ฒฐํ•ด์ฃผ๊ณ  ์ด๋žฌ๋‹ค..

ํ•˜์ง€๋งŒ ํ•ด๊ฒฐ์€ ๋˜์ง€ ์•Š์•˜๊ณ , ํ„ฐ๋ฏธ๋„ ๋กœ๊ทธ๋ฅผ ์ž์„ธํžˆ ๋˜์‚ดํŽด๋ณด๋‹ˆ ์ด๋Ÿฐ ๊ตฌ์ ˆ์„ ๋ณด๊ฒŒ๋˜์—ˆ๋‹ค.
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
๐Ÿ‘‰ ์ž๋ฐ” ๋ฒ„์ „์ด ๋‚ฎ์œผ๋‹ˆ 11๋กœ ์จ์ฃผ์„ธ์š”~ ์˜ ๋œป์ด๊ฒ ์ง€.

๊ทธ๋ž˜์„œ ์ƒ๋‹จ ์ธ์šฉ์—์„œ ์–ธ๊ธ‰ํ–ˆ๋˜ ํ•„์ˆ˜ ๋ถ€์žฌ๋ฃŒ (๋‹ค๋Œ€๊ธฐ ๊ฐ™์€ ์กด์žฌ) : Java 11 ๋ฒ„์ „ ์„ค์น˜ ๋ฅผ ์ฐธ๊ณ ํ•˜์—ฌ JAVA 11์„ ์„ค์น˜ํ•˜์—ฌ ๊ธฐ์กด JAVA๊ฐ€ ๋ชจ์—ฌ์žˆ๋Š” ํด๋”์— ์œ„์น˜์‹œ์ผฐ๋‹ค.
๊ธฐ์กด JAVA ํด๋”์—์„œ ํ™˜๊ฒฝ๋ณ€์ˆ˜ ๋ฐ Path ์„ค๊ณ„๊ฐ€ ๋˜์–ด์žˆ์œผ๋ฏ€๋กœ ๊ฐ™์€ ์œ„์น˜์— ๋‘๋ฉด ํ™˜๊ฒฝ๋ณ€์ˆ˜๋ฅผ ํฌ๊ฒŒ ๊ฑด๋“ค์ด์ง€ ์•Š์•„๋„ ๋˜์„œ ๊ทธ๋ ‡๊ฒŒ ํ•ด๋†จ๋‹ค.

ํ„ฐ๋ฏธ๋„์—์„œ java -version ์œผ๋กœ ์ž๋ฐ” ๋ฒ„์ „์ด 11๋กœ ๋˜์–ด์žˆ๋Š” ๊ฒƒ์„ ํ™•์ธํ•˜๊ณ  ๋‹ค์‹œ VSCode์—์„œ ์„œ๋ฒ„๋ฅผ ์‹คํ–‰ํ•˜์˜€๋‹ค.

๊ฒฐ๊ณผ๋Š” ์‹คํŒจ์˜€๋‹ค.

์—ฌ๊ธฐ ๋ธ”๋กœ๊ทธ๋ฅผ ํ†ตํ•ด์„œ jdk 11 ์„ค์ •์„ ์ถ”๊ฐ€๋กœ Gradle์— ๋„ฃ์–ด์ค˜์•ผํ•œ๋‹ค๋Š” ๊ฒƒ์„ ์•Œ์•„๋‚ด๊ณ  ๋˜‘๊ฐ™์ด ํ•˜๋ ค๊ณ  ํ–ˆ์œผ๋‚˜...

์—†๋‹ค ๐Ÿคฏ

์œ„์™€ ์•„๋ž˜ ์‚ฌ์ง„์ด ๋ฌด์—‡์ด ๋‹ค๋ฅผ๊นŒ?
๊ฐ™์€ Settings ์—์„œ Gradle projects ์—์„œ JDK๋ฅผ ๋”ฐ๋กœ ์ง€์ •ํ•ด์ค„ ์ˆ˜ ์žˆ๋Š” ์นธ์ด ์—†๋‹ค๋Š” ๊ฒƒ์ด๋‹ค.
๋ฌผ๋ก  ๋‚ด ์•ˆ๋“œ๋กœ์ด๋“œ ์ŠคํŠœ๋””์˜ค๋Š” ์ตœ. ์‹  ๋ฒ„์ „์ž„์—๋„ ๋ถˆ๊ตฌํ•˜๊ณ  ๋ง์ด์ง€.

๊ทธ๋Ÿฐ๋ฐ ๋˜ ์›ƒ๊ธด ๊ฒƒ์€ ๊ฐ‘์ž๊ธฐ ๋œ๋‹ค?

์ •ํ™•ํ•œ ์ด์œ ๋ฅผ ๋ชจ๋ฅด๊ฒ ์ง€๋งŒ, ์•„๋งˆ ํ™˜๊ฒฝ๋ณ€์ˆ˜๊ฐ€ ์ ์šฉ๋˜๋Š”๋ฐ ๊นŒ์ง€ ์‹œ๊ฐ„์ด ์กฐ๊ธˆ ๊ฑธ๋ฆฐ๊ฒŒ ์•„๋‹Œ๊ฐ€... ๋ผ๋Š” ์ถ”์ธก์„ ํ•ด๋ณธ๋‹ค.

์–ด์จ‹๋“  ์„ฑ๊ณต์ด๊ธด ํ•˜์ง€๋งŒ, ์™œ ๋˜๋Š”์ง€.. app/src/build.gradle ํŒŒ์ผ์—์„œ import com.android.build.OutputFile ๊ตฌ์ ˆ์— unable to resolve class com.android.build.OutputFile ์ด๋ผ๋Š” ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Œ์—๋„ ์™œ ์ž˜๋˜๋Š”์ง€๊ฐ€ ๊ถ๊ธˆํ•˜๊ธด ํ•˜๋‹ค.

ํ•  ์ผ์ด ์ง€๊ธˆ ๋งŽ๊ธฐ์— ์ถ”ํ›„์— ์•Œ๊ฒŒ๋˜๋ฉด ์ถ”๊ฐ€๋กœ ๋‹ฌ์•„๋†“์œผ๋ ค๊ณ  ํ•œ๋‹ค.

reference:
https://reactnative.dev/docs/environment-setup?guide=quickstart

profile
ํƒœ์–ด๋‚œ ๊น€์— ๋งŽ์€ ๊ฒฝํ—˜์„ ํ•˜๋ ค๊ณ  ์•„๋“ฑ๋ฐ”๋“ฑ ์• ์“ฐ๋Š” ํ”„๋ก ํŠธ์—”๋“œ ๊ฐœ๋ฐœ์ž
post-custom-banner

0๊ฐœ์˜ ๋Œ“๊ธ€