• 카테고리

    질문 & 답변
  • 세부 분야

    모바일 앱 개발

  • 해결 여부

    미해결

VIsual studio code 에서 react-native run-android 실행시 오류

23.12.13 21:40 작성 23.12.13 21:41 수정 조회수 286

0

다음과 같이 오류가 나옵니다.

안드로이드 에뮬레이터는 실행되지만 APP.js에서 작성한 코드를 띄우려 시도 불가입니다.

FAILURE: Build failed with an exception.

* What went wrong:

Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

> Exception java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.reflection.ReflectionCache [in thread "Daemon worker"]

* 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 4s

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.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:

Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

> Exception java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.reflection.ReflectionCache [in thread "Daemon worker"]

* 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 4s

at checkExecSyncError (child_process.js:616:11)

at execFileSync (child_process.js:634:13)

at runOnAllDevices (C:\Users\82107\kkk\my_first_app\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)

at process._tickCallback (internal/process/next_tick.js:68:7)

답변 2

·

답변을 작성해보세요.

0

이규행님의 프로필

이규행

질문자

2023.12.19

윈도우입니다.

그리고 gradle를 최신버전으로 설치했는데 동일합니다 해결방법 부탁해요

0

인프런 AI 인턴님의 프로필

인프런 AI 인턴

2023.12.14

안녕하세요, 인프런 AI 인턴입니다.

해당 오류는 org.codehaus.groovy.runtime.InvokerHelper 클래스를 초기화하는 과정에서 문제가 발생한 것으로 보입니다. 이 문제는 Groovy 버전의 충돌 또는 Gradle과 관련된 문제일 수 있습니다. 다음 단계를 따라 문제를 해결해보시길 권장합니다.

  1. 프로젝트의 gradle-wrapper.properties 파일에서 사용 중인 Gradle 버전을 확인하고 필요하다면 업데이트하세요.
  2. 로컬에 설치된 Gradle 버전이 올바른지 확인해보세요. Gradle 버전 확인 방법:
    
    $ gradle --version
    

  3. Groovy 버전의 충돌이 발생할 수 있으니, 시스템에 설치된 Groovy를 업데이트하거나 제거 후 다시 시도해보세요.
  4. Gradle의 종속성 캐시를 정리하려면, 프로젝트 디렉토리에서 다음 명령을 실행하세요:
    
    $ ./gradlew clean
    

  5. --stacktrace 옵션을 사용하여 더 상세한 스택 트레이스를 확인하세요:
    
    $ ./gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 --stacktrace
    

  6. 안드로이드 개발 환경 설정을 다시 점검하세요. React Native 공식 문서에서 안드로이드 개발 환경 설정에 대한 안내를 찾을 수 있습니다.

여전히 문제가 해결되지 않으면, Gradle과 관련된 더 많은 로그 정보를 볼 수 있도록 --info 또는 --debug 옵션을 추가하여 빌드를 실행해보세요.

참고: 안드로이드 개발 환경 구성에 도움이 필요하다면, React Native의 Android 개발 환경 설정 문서를 참조하시기 바랍니다.

이규행님의 프로필

이규행

질문자

2023.12.18

윈도우입니다.

그리고 gradle를 최신버전으로 설치했는데 동일합니다 해결방법 부탁해요