반응형
리액트 책을 보면서 공부하는 와중에 CLI로 생성한 프로젝트가 안드로이드 에뮬레이터 위로 안착되지 않는 문제가 발생하였다. 책에서는 터미널에 npm run android를 입력하면 안드로이드 에뮬레이터 위에서 작성한 앱이 돌아간다고 하는데, 나는 자꾸 아래 사진과 같은 에러가 발생하는 것이었다.
FAILURE: Build failed with an exception.
* What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
* 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 1s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
위와 같은 오류가 뜬다고 하면서 안 된다고 하는데, 위 에러들을 구글링하여보니 프로젝트 내의 gradle의 버젼정보를 변경하는 것으로 해결할 수 있다 해서 따라해보았더니 해결되었다.
distributionUrl=https://services.gradle.org/distributions/gradle-6.2-all.zip
=> distributionUrl=https://services.gradle.org/distributions/gradle-6.3-all.zip
해당 변경사항을 저장하고 다시 터미널에 npm run android을 입력하니, 아래 사진처럼 정상적으로 작동되었다.
반응형