이번 프로젝트에서 리액트 네이티브로 모바일을 개발하기로 되었다.

그래서 우선 React Native를 학습하면서 생기는 오류들을 정리하려고 한다.

 

1. 안드로이드로 실행 시 오류 - 구글 플레이 라이센스 문제

 

D:\test\reactnative\AwesomeProject>react-native run-android
info JS server already running.
info Building and installing the app on the device (cd android && gradlew.bat app:installDebug)...
Downloading https://services.gradle.org/distributions/gradle-5.4.1-all.zip
..............................................................................................................................

Welcome to Gradle 5.4.1!

Here are the highlights of this release:
 - Run builds with JDK12
 - New API for Incremental Tasks
 - Updates to native projects, including Swift 5 support

For more details see https://docs.gradle.org/5.4.1/release-notes.html

Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

> Configure project :app
File C:\Users\kyoborealco\.android\repositories.cfg could not be loaded.
Checking the license for package Android SDK Build-Tools 28.0.3 in C:\tools\Android\sdk\licenses
Warning: License for package Android SDK Build-Tools 28.0.3 not accepted.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
     build-tools;28.0.3 Android SDK Build-Tools 28.0.3
  To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
  Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html

  Using Android SDK: C:\tools\Android\sdk

* 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 1m 11s
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.

D:\test\reactnative\AwesomeProject>

 

구글 플레이 라이센스 문제로 android studio 에서 

Tools < SDK Manager 메뉴로 들어가서

SDK Tools 탭으로 이동하면 중간 쯤에 Google Play Licensing Library 항목이 있다.

이게 인스톨되지 않으면 생기는 오류이다.

해당 항목을 인스톨 하고 재실행하면 된다.

 

 

 

2. 안트로이드 버추어 디바이스 연결 불가 오류

 

D:\test\reactnative\AwesomeProject>react-native run-android
info JS server already running.
info Building and installing the app on the device (cd android && gradlew.bat app:installDebug)...
11:42:04 D/DeviceMonitor: Opening adb connection
> Task :app:installDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:installDebug'.
com.android.builder.testing.api.DeviceException: No connected devices!

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more lo

* Get more help at https://help.gradle.org

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

BUILD FAILED in 2s
26 actionable tasks: 1 executed, 25 up-to-date
<-------------> 0% WAITING
> IDLE
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.

 

안드로이드 스튜디오 버추얼 디바이스가 실행되지 않아서 생긴문제이다.

안드로이드 스튜디오에서

Tools > AVD Manager 메뉴로 들어가면 Andriod Virtual Device Manager 창이 열리고 

여기서 디바이를 더블클릭하여 버츄어 디바이스 실행 후 

명령어를 실행하면 정상 작동된다.

 

+ Recent posts