React Native Getting Started νμ΄μ§μ λ΄μ©μ λ°λΌνλ©΄μ λ°μν λ¬Έμ λ€μ λλ€.
- μμνκΈ° μ λ§? #1
- μμνκΈ° μ λ§? #2
- μμνκΈ° μ λ§? #3 π
κΈ°λ³Έμ μΈ μ€μΉ λ° κ΅¬μ±μ νμ΄μ§λ₯Ό 보며 μ§ννμ΅λλ€.
μ μ νκ²½μ macOS 10.14.5 μ λλ€.
Expo λ μ¬μ©νμ§ μκ³ , React Native CLI λ‘ νλ‘μ νΈλ₯Ό μ€μΊν΄λ©νμ΅λλ€.
Node, XCode, Android Studio κ° μ€μΉλμ΄ μμ΅λλ€.
- Node v11.7.0
- npm v6.5.0
- Xcode v10.2.1 (10E1001), XCode command line tools installed
- Android Studio v3.4, Android SDK installed
Xamarin μΌλ‘ μμ±λ λͺ¨λ°μΌ μμ©νλ‘κ·Έλ¨μ React Native λ‘ μ¬μμ±νκΈ° μν΄ νλ‘μ νΈλ₯Ό λ§λ€μμ΅λλ€.
$ react-native init ScoreBoard
μ΄μ μλμ₯ νμμΌλ‘ λμνλ λ©λ΄λ₯Ό μμ±νκΈ° μν΄ λ€λΉκ²μ΄μ κ΄λ ¨ ν¨ν€μ§ μΆκ°νκ³ μ€ννλ λ λ¬Έμ κ° λ°μν©λλ€.
react-native-gesture-handler
ν¨ν€μ§λ λ€μ΄ν°λΈ μ½λκ° ν¬ν¨λμ΄ μμ΅λλ€.
λ°λΌμ link λͺ
λ ΉμΌλ‘ ν΄λΉ λ΄μ©μ κ° νλ«νΌ νλ‘μ νΈμ μΆκ°λμ΄μΌ ν©λλ€.
νμ΄μ§μ μ€λͺ λλ‘ μλ λͺ λ Ήμ μ€νν©λλ€.
$ react-native link react-native-gesture-handler
μλλ‘μ΄λ κ°μμ₯μΉμμ νμΈνκΈ° μν΄ μ€νν©λλ€.
$ react-native run-android
react-native run-android
error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
- react-native-gesture-handler (to unlink run: "react-native unlink react-native-gesture-handler")
This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink <dependency>" and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.
Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md
info Starting JS server...
info Installing the app...
> Task :react-native-gesture-handler:compileDebugJavaWithJavac FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
14 actionable tasks: 2 executed, 12 up-to-date
/Users/bbon/Repos/scoreboard-rn/ScoreBoard/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.java:3: error: package android.support.v4.util does not exist
import android.support.v4.util.Pools;
^
/Users/bbon/Repos/scoreboard-rn/ScoreBoard/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.java:19: error: package Pools does not exist
private static final Pools.SynchronizedPool<RNGestureHandlerEvent> EVENTS_POOL =
^
/Users/bbon/Repos/scoreboard-rn/ScoreBoard/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.java:3: error: package android.support.v4.util does not exist
import android.support.v4.util.Pools;
^
/Users/bbon/Repos/scoreboard-rn/ScoreBoard/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.java:19: error: package Pools does not exist
private static final Pools.SynchronizedPool<RNGestureHandlerStateChangeEvent> EVENTS_POOL =
^
/Users/bbon/Repos/scoreboard-rn/ScoreBoard/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.java:20: error: package Pools does not exist
new Pools.SynchronizedPool<>(TOUCH_EVENTS_POOL_SIZE);
^
/Users/bbon/Repos/scoreboard-rn/ScoreBoard/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.java:20: error: package Pools does not exist
new Pools.SynchronizedPool<>(TOUCH_EVENTS_POOL_SIZE);
^
Note: /Users/bbon/Repos/scoreboard-rn/ScoreBoard/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
6 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-gesture-handler:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 5s
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
/Users/bbon/Repos/scoreboard-rn/ScoreBoard/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.java:3: error: package android.support.v4.util does not exist
import android.support.v4.util.Pools;
^
/Users/bbon/Repos/scoreboard-rn/ScoreBoard/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.java:19: error: package Pools does not exist
private static final Pools.SynchronizedPool<RNGestureHandlerEvent> EVENTS_POOL =
^
/Users/bbon/Repos/scoreboard-rn/ScoreBoard/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.java:3: error: package android.support.v4.util does not exist
import android.support.v4.util.Pools;
^
/Users/bbon/Repos/scoreboard-rn/ScoreBoard/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.java:19: error: package Pools does not exist
private static final Pools.SynchronizedPool<RNGestureHandlerStateChangeEvent> EVENTS_POOL =
^
/Users/bbon/Repos/scoreboard-rn/ScoreBoard/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.java:20: error: package Pools does not exist
new Pools.SynchronizedPool<>(TOUCH_EVENTS_POOL_SIZE);
^
/Users/bbon/Repos/scoreboard-rn/ScoreBoard/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.java:20: error: package Pools does not exist
new Pools.SynchronizedPool<>(TOUCH_EVENTS_POOL_SIZE);
^
Note: /Users/bbon/Repos/scoreboard-rn/ScoreBoard/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
6 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-gesture-handler:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 5s
at checkExecSyncError (child_process.js:625:11)
at execFileSync (child_process.js:643:13)
at runOnAllDevices (/Users/bbon/Repos/scoreboard-rn/ScoreBoard/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:75:39)
at buildAndRun (/Users/bbon/Repos/scoreboard-rn/ScoreBoard/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:137:41)
at then.result (/Users/bbon/Repos/scoreboard-rn/ScoreBoard/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:103:12)
at processTicksAndRejections (internal/process/next_tick.js:81:5)
μΆλ ₯λ μλ¬ λ©μμ§ κ΄λ ¨ λ΄μ©μΌλ‘ κ²μλ κΉνλΈ μ΄μ νμ΄μ§μμ λ°©λ²μ μ μν©λλ€.
jetifier ν¨ν€μ§λ₯Ό μ€μΉνκ³ , μ€νν©λλ€.
$ npm install jetifier
$ npx jetify
λ€μ link λͺ λ Ήμ μ€νν©λλ€.
$ react-native link react-native-gesture-handler
μ΄μ μ μμ μΌλ‘ μ€νλ©λλ€.
$ react-native run-android
iOS κ°μμ₯μΉμμλ λΉλ λ¬Έμ κ° λ°μν΄μ, pod μΌλ‘ μμ‘΄ ν¨ν€μ§λ₯Ό λ€μ μ€μΉνλλ‘ ν ν μ€νν©λλ€.
$ cd ios
$ pod install
$ cd ..
$ react-native run-ios
μ μμ μΌλ‘ μ€νλ©λλ€.