react native 윈도우 실행 오류

23.07.29 03:51 작성 23.07.29 03:52 수정 조회수 805

0

이번에 처음으로 앱 개발 공부를 해보려고 react native를 열심히 실행해 봤습니다.

중간에 계속 에러가 나고 막히는 부분이 있었지만 겨우 마지막에 npm run android부분까지 왔습니다. 그런데 실행을 할려고 하면 계속

C:\Users\aladi\MyApp\NewApp>npx react-native run-android
info Starting JS server...

info 💡 Tip: Make sure that you have set up your development environment correctly, by running react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor


FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Build file 'C:\Users\aladi\MyApp\NewApp\android\app\build.gradle' line: 2

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not find implementation class 'com.facebook.react.ReactPlugin' for plugin 'com.facebook.react' specified in jar:file:/C:/Users/aladi/.gradle/caches/jars-9/e787d8a8f912d81d210d8e27e6fa5ed3/react-native-gradle-plugin.jar!/META-INF/gradle-plugins/com.facebook.react.properties.

* 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.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':app'.
> compileSdkVersion is not specified. Please add it to build.gradle

* 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 12s
error Failed to install the app. Command failed with exit code 1: gradlew.bat tasks FAILURE: Build completed with 2 failures. 1: Task failed with an exception. ----------- * Where: Build file 'C:\Users\aladi\MyApp\NewApp\android\app\build.gradle' line: 2 * What went wrong: A problem occurred evaluating project ':app'. > Could not find implementation class 'com.facebook.react.ReactPlugin' for plugin 'com.facebook.react' specified in jar:file:/C:/Users/aladi/.gradle/caches/jars-9/e787d8a8f912d81d210d8e27e6fa5ed3/react-native-gradle-plugin.jar!/META-INF/gradle-plugins/com.facebook.react.properties. * 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. ============================================================================== 2: Task failed with an exception. ----------- * What went wrong: A problem occurred configuring project ':app'. > compileSdkVersion is not specified. Please add it to build.gradle * 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 12s
> Task :gradle-plugin:compileKotlin UP-TO-DATE > Task :gradle-plugin:compileJava NO-SOURCE > Task :gradle-plugin:pluginDescriptors UP-TO-DATE > Task :gradle-plugin:processResources UP-TO-DATE > Task :gradle-plugin:classes UP-TO-DATE > Task :gradle-plugin:jar UP-TO-DATE > Task :gradle-plugin:inspectClassesForKotlinIC UP-TO-DATE 5 actionable tasks: 5 up-to-date.

이런 에러가 뜨더라구요

정말 이쪽부분은 하나도 모르는 코린이라 아무리 구글링해보고 혼자 머리 굴려봐도

해결이 되지 않습니다.. 에뮬레이터까지는 뜨는데 react native화면은 뜨지 않고 저렇게 에러 메세지만 나옵니다. 어떻게 해야될까요.. 제발 도와주세요ㅜ

답변 1

답변을 작성해보세요.

0

인프런 AI 인턴님의 프로필

인프런 AI 인턴

2023.07.30

안녕하세요, 인프런 AI 인턴이에요.

React Native 앱 개발 공부를 진행하다가 윈도우 실행 오류가 발생하셨군요. 오류 메시지에는 여러 가지 내용이 포함되어 있는데, 일단 가장 중요한 부분을 확인해보겠습니다.

에러 메시지에 따르면 ‘C:\Users\aladi\MyApp\NewApp\android\app\build.gradle’에서 문제가 발생한 것으로 나와 있습니다. 또한 ‘com.facebook.react.ReactPlugin’과 관련된 클래스를 찾을 수 없다는 내용이 있습니다.

오류 해결을 위해 몇 가지 확인해볼 사항이 있습니다.
1. React Native 환경 설정을 제대로 마쳤는지 확인해주세요. 다음 명령어를 실행하여 React Native 환경을 확인할 수 있습니다.

npx react-native doctor

확인 결과에 빨간색으로 표시된 문제들이 있다면 해당 문제들을 해결하셔야 합니다.

  1. React Native 프로젝트의 종속성을 최신 버전으로 업데이트할 필요가 있는지 확인해주세요. 다음 명령어를 실행하여 종속성을 업데이트할 수 있습니다.
npm install
  1. React Native 프로젝트의 Gradle 파일을 확인해보세요. ‘C:\Users\aladi\MyApp\NewApp\android\app\build.gradle’ 파일이 존재하는지, 그리고 내용이 올바른지 확인해보세요. 필요한 설정이 있는지 잘 확인하셔야 합니다.

위의 사항들을 차례대로 확인하고 문제가 해결되지 않는다면, 구체적인 스택 트레이스 정보나 로그를 더 살펴보실 필요가 있을 수 있습니다. 해당 명령을 실행할 때 ‘Run with –stacktrace’나 ‘–info’, ‘–debug’ 등과 같이 추가 옵션을 사용하여 더 자세한 로그 출력을 확인해보세요.

더 자세한 내용이 필요하다면 React Native 커뮤니티나 관련 포럼 등에서 질문해보시는 것도 좋은 방법일 수 있습니다. React Native에 대한 이해도가 높은 전문가들이 도움을 줄 수 있을 거예요.

문제 해결에 도움이 되었길 바라며, 성공적인 앱 개발 공부를 진행하시길 바랍니다. 추가로 궁금한 사항이 있으면 언제든지 물어보세요. 좋은 결과 있기를 기대할게요.