본문 바로가기

dev/react-native

RN 초기 설정시 발생한 에러 처리

1.Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0 #29829

react native cli 를 설치 후 react-native init 시 발생하는 에러다. Gradle 버전 이슈이며, 비교적 최근에 발견된 이슈다.

글을 읽다 보면 적절한 처리법이 있다.

 

github.com/facebook/react-native/issues/29829#issuecomment-727280671

 

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0 · Issue #29829 · facebook/react-nat

Hi i dont know whats wrong but i am getting this error continuously. Even i tried all with the fresh version also. Deprecated Gradle features were used in this build, making it incompatible with Gr...

github.com

제시한 해결책은 다음과 같다.

  • I followed this previous answer on a similar issue
  • This brought to the Gradle versions correspondances
  • I updated the classpath("com.android.tools.build:gradle:X.X.X") in android/build.gradle (it was version 3.5.3, I now use version 4.1.0)
  • The next triggered error required to update gradle from verion 6.2 to 6.5. So, I updated distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip in android/gradle/wrapper/gradle-wrapper.properties

위 방법을 따라 처리하면 정상적으로 빌드된다.

 

2. Unable to load script. Make sure you're either running a Metro server ...

dlevelb.tistory.com/1142에서 해결책을 찾았다.

 

1. [패키지명]/android/app/src/main/assets 폴더가 있는지 확인하고 없으면 생성

2. [패키지명]/android 폴더에서 ./gradlew clean 실행

3. [패키지명] 폴더에서 아래 명령어 실행

react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res

4. react-native run-android