React-Native 오류: 기본 클래스 org.gradle.wrapper.GradleWrapperMain을 찾거나 로드할 수 없습니다.

React-Native 오류: 기본 클래스 org.gradle.wrapper.GradleWrapperMain을 찾거나 로드할 수 없습니다.

Ubuntu에 대한 반응 네이티브 튜토리얼을 시작하려고 하는데 이미 nodejs, 반응 네이티브 명령줄 인터페이스, JDK 및 Android Studio를 설치했습니다. 이미 환경 변수를 설정했기 때문에 run 을 시도하면 react-native run-android다음 오류가 나타납니다.

info Starting JS server...
info Building and installing the app on the device (cd android && ./gradlew app:installDebug)...
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
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 app:installDebug

이에 대한 해결책을 찾을 수 없습니다.

답변1

그래서 제가 한 일은 다운로드였습니다.이 JAR 파일( gradle-wrapper.jar)그것을 안에 넣은 android/gradle/wrapper다음 프로젝트 디렉토리로 돌아가서 다음을 수행했습니다.

npm install 

그런 다음 다음을 수행하여 디렉토리를 Android로 변경했습니다.

cd android

그런 다음 다음 명령을 실행했습니다.

chmod +x ./gradlew

xattr -l ./gradlew

이제 프로젝트 디렉토리로 돌아가서 실행했습니다.react-native run-android

관련 정보