React-Native Build Error Issue History

Myung Jin Kim·2023년 10월 5일
0

오랜만에 react-native project 를 빌드 및 배포를 해야 해서 작업 중에 android, ios 둘 다 빌드를 실패하는 경이로운 일이 생겨서 무려 2시간을 허공에 던져버렸다.

이번에 각 case 별로 issue 를 정리하고 후에 관련 issue 및 내용을 더 찾아보던가 말던가 해야겠다.

Android

  • Duplicate resources
    증상
    android/ 에서 ./gradlew clean 후 ./gradlew assembleRelease 를 실행했는데 해당 Error 가 뜨면서 Build 를 실패했다.
    해결
    스택오버플로우에서
    npm run 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/build/intermediates/res/merged/release/ && rm -rf android/app/src/main/res/drawable-* && rm -rf android/app/src/main/res/raw/* && cd android && ./gradlew assembleRelease && cd ..
    커맨드를 알려줬고 이걸로 빌드해서 apk file 을 뽑아낼 수 있었다.

IOS

  • #import <RCTAppDelegate.h> not found
    증상
    node_modules 설치도 하고 xcode dependency packages 들도 모두 설치 후
     npm run react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --assets-dest='./ios/' --dev=false --platform='ios'
    해당 Command 를 실행했는데 아무 이슈가 없어서 Xcode 에서 Archive 후 Distribute 하려고 했는데 Bundle File 을 찾지 못했다. Xcode 에서 빌드했더니 #import <RCTAppDelegate.h> not found error 가 뜬다.
    해결
    해당 error 검색하면 M1 에서 react-native greater than 0.71 version RCTAppDelegate.h not found issue 가 있다고 스택오버플로우, github 에 이슈들이 올라온다. 난 모르는 일이지만 내 경우에는 Workspace 를 열어야했는데 Project 를 열어서 못찾았다.
profile
개발을 취미로 하고 싶은 개발자를 목표로 살고 있습니다

0개의 댓글