REACT NATIVE 디버깅 모음집

YEONGHUN KO·2024년 9월 13일
0

ETC

목록 보기
31/31
post-thumbnail

devtools breaking point를 잘 사용해볼것

빌드

android studio

  1. Failed to construct transformer: Error: error:0308010C:digital envelope routines::unsupported in React native
    A: https://stackoverflow.com/questions/77088464/failed-to-construct-transformer-error-error0308010cdigital-envelope-routines

  2. Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0
    https://stackoverflow.com/questions/51610420/deprecated-gradle-features-were-used-in-this-build-making-it-incompatible-with

  3. react-native-calendars/src/calendar/ img/ic_calendar_arrow_left.png: Attempt to access memory outside buffer bounds
    ==> react-native-calendars를 지웠다가 다시 설치하니 잘 됨.

  4. Unsupported class file major version 66"
    ==> JDK11버전을 설치해볼것

  5. Failed to transform react-native-0.71.0-rc.0-debug.aar
    https://github.com/facebook/react-native/issues/35210#issuecomment-1304536693

  6. Android localhost => http://10.0.2.2:8080/ or setting - network - 세부사항 - tcp/ip - ip address를 확인해볼것

    1. 컴터 켤때마다 바뀔 수 있음.
  7. Id of type must be of type string (metro-transform-worker/src/index.js)

    1. npx react-native start --reset-cache (metro cache clean)
  8. Keeps stopping - Requested enabled DevSupportManager, but DevSupportManagerImpl class was not found or could not be created (logical)

    • Android / build.gradle에서 targetSdkVersion = 33 이하로 바꿔보기
  9. INSTALL_FAILED_VERSION_DOWNGRADE: Downgrade detected: Update version code 17 is older than current 19 react native
    : android/app/build.gradle - versionCode를 17에서 19로 올리기!!

  10. java.util.concurrent.ExecutionException: org.gradle.api.GradleException: Failed to install on any devices.

    1. ./gradlew clean 하기
  11. Could not read script 'C:\경로\node_modules\react-native-config\android\dotenv.gradle' as it does not exist.

    1. Nom install 해서 react-native-config를 설치한다 ㅋㅋㅋㅋ
  1. Could not find com.facebook.fresco.stetho #32944
    : https://github.com/facebook/react-native/issues/32944 ==>  gradle.proprties 안의 FLIPPER_VERSION을 0.99.0으로!!

Xcode

  1. tried: '/Library/Ruby/Gems/2.6.0/gems/ffi-1.17.0-x86_64-darwin/lib/2.6/ffi_c.bundle' ==> Mac OS bit문제

https://github.com/CocoaPods/CocoaPods/issues/10518

  1. REXML::ParseException - #<TypeError: wrong argument type String (expected Regexp)> pod install
    https://github.com/CocoaPods/CocoaPods/issues/12407

  2. Undefined symbols

  • https://th-biglight.tistory.com/23
  • 위의 방법이 안되면
  • npm cache clean --force && rm -rf node_modules && npm install --legacy-peer-deps
- npm start -- --reset-cache ==> metro cache clean하는 법
  • React native version upgrade
  1. Library-budify not found
    => https://stackoverflow.com/questions/23539147/xcode-ld-library-not-found-for-lpods 참고
    1. projectname.xcworkspace를 열어보기
    2. sudo gem update cocoapods && pod install
    rm -rf ~/Library/Developer/Xcode/DerivedData/
    rm -rf "${HOME}/Library/Caches/CocoaPods"
    rm -rf "pwd/Pods/"
    pod update
    ==> 라고 하니 “module map file not found” 라고 뜸…

  2. Rtc file not found
    Podfile에서 # use_frameworks! :linkage => :static 주석처리하기

  3. RCTAppDelegate.h file not found

  • npm install
  • remove pod
  • remove pod.lock
  • reinstall the arch -x86_64 pod install --repo-update
  1. Command PhaseScriptExecution failed with a nonzero exit code - 물리적 아이폰을 연결했을 경우
    ==> https://github.com/facebook/react-native/issues/36762
  1. Build failed in Xcode
    xcodebuild clean 타이핑 해서 나오는 명령어 입력
    xattr -w com.apple.xcode.CreatedByBuildSystem true /Applications/budifyApp/ios/build ==> 버디파이
  1. Command PhaseScriptExecution failed with a nonzero exit code
    : 그러고 log에 들어가보니, readlink,cd같은 shell command line을 찾을 수 없다는 내용이었다. .bash_profile에서
    Vscode debugging이 되게하려고 추가해놓은 path를 지웠다. gpt한테 물어보니 마지막에 설정된, “export PATH=/Users/a./Library/Android/sdk/platform-tools
    “ 이게 문제였다고. 이건 PATH를 overriding한다는 것. 그래서 path를 설정할때는 상대경로처럼 아래처럼 설정하기.

Always append or prepend to the PATH variable rather than overwriting it, to ensure essential system directories remain included.

export PATH=$PATH:/some/other/directory

  1. failed to connect to localhost/8081

    • $ adb -s emulator-5554 reverse tcp:3000 tcp:3000
  2. Requiring unknown module "90”

    • Node server가 하나 더 vscode 터미널에 열려있었음.
  3. Pod clean

  • pod cache clean --all
  1. Invariant Violation: requireNativeComponent: “라이브러리이름” was not found in the UIManager.
    cd ios
    pod install --repo-update
    하고 다시 빌드해보기

react-devtools

react-devtools 라고 타이핑하니 아무 반응이 없었다…

=> 원인은 NODE_OPTIONS=—ssl-….-provider가 ~/.zshrc에 저장되어있었고, eletron이 이것을 읽지못해 생겨난 문제. ==> “NODE_OPTIONS=' ' react-devtools" 라고 터미널에 입력하니 잘 됨

loading.. stuck이라고 devtools에 뜸

=> adb reverse tcp:8097 tcp:8097 라고 하니 잘됨

혹시 open toggle 하고 클릭했는데도 devtool에서 감지를 못하면?

=> Start debuggin을 해서 localhost:8081에 디버깅을 페이지를 열고 해보자.
=> 안되면 metro, devtools, vm다 끄고 다시 다 켜서 해보자.

배포에러

main.jsbundle does not exist 

-https://velog.io/@dody_/RN-%EC%97%90%EB%9F%AC%EB%85%B8%ED%8A%B8-main.jsbundle-does-not-exist-

Xcode에서 배포를위해 archive build이후 Asset validation error가 뜬다면?

  1. Open your Xcode project.
  2. Navigate to the project settings:
    • Click on your project in the Project Navigator.
    • Select your app target under "Targets".
    • Click on the "General" tab.
  3. Update the Version Number:
    • Find the "Version" field under "Identity".
    • Increment this number to a higher version (e.g., from 1.9.3 to 1.9.4 or 2.0.0).
  4. Update the Build Number:
    • Optionally, you can also update the "Build" field to a higher number if needed.

If your current Info.plist looks like this:

CFBundleShortVersionString
1.8.6
CFBundleVersion
1

Update it to:

CFBundleShortVersionString
1.9.4
CFBundleVersion
2

Final Steps:
1. Save the changes.
2. Rebuild your app.
3. Attempt to upload the new build to the App Store again.

firebase app distribution(테스트 앱)

빌드후에 firebase app distribution 에 ipa를 올렸을 경우 이미지 파일이 안보일때 build phase에 main.bundlejs랑 asset폴더를 add other버튼을 눌러서 추가하기

배경지식

  1. What is arm64 and x86?
    https://www.quora.com/What-is-arm64-vs-x64

  2. Cocopods
    Dependency managers for swift and objective-c

배포

iOS

https://singularis7.tistory.com/122

android

  1. 빌드하는법 :
    $ cd /Library/Java/JavaVirtualMachines/jdkX.X.X_XXX.jdk/Contents/Home
    $ sudo keytool -genkey -v -keystore budify.keystore -alias buddy -keyalg RSA -keysize 2048 -validity 10000

해서 keystore를 android/app에 넣기 그리고 아래 명령어 실행.

$cd android && ./gradlew bundleRelease => aab추출 android/app/build/outputs/bundle/release/app.aab처럼 파일 생성됨
* 참고로 ./gradlew assembleRelease => apk 파일 추출 android/app/build/outputs/apk/debug/app.apk 처럼 파일 생성됨

혹시 algorithm not supported 에러가 생기면 “sudo keytool -genkeypair -v -keystore budify.keystore -alias budify -keyalg RSA -keysize 2048 -validity 10000 -sigalg SHA256withRSA
“ 라고 해보기.
출처 : https://stackoverflow.com/questions/76431205/flutter-build-app-bundle-error-algorithm-hmacpbesha256-not-available

  1. Execution failed for task ':app:bundleReleaseResources'.> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade라는 에러를 마주함
    : Google play - App must target Android 14 (API level 34) or higher 에러를 해결하기 위해 sdkVersion을 34로 올려야함. 그래서 34로 올리고 complieSdkVersion을 34로 올린다음 build 했는데 에러가 나타났음…
    complieSdkVersion를 31로 낮추면 해결

—>https://stackoverflow.com/questions/73909333/using-a-newer-android-gradle-plugin-in-react-native 참고바람

“./gradlew clean --warning-mode all” 를 입력하여 더 많은 정보를 얻어 볼 것.

물리적 디바이스에서 일어나는 로그를 알고싶으면?
$ adb logcat
파도같이 많은 로그중에 특정 로그만 알고싶으면? (ex> SecurityException이 적힌것만)
$ adb logcat | grep "SecurityException"

  1. “INSTALL_FAILED_UPDATE_INCOMPATIBLE”
    :indicates that the new APK you're trying to install has a different signing key than the previously installed version.
    => $ adb uninstall com.reactnativebudify

  2. java.lang.RuntimeException: java.io.FileNotFoundException: /data/user/0/com.reactnativebudify/lib-0/dso_lock: open failed: EACCES (Permission denied)
    : so_loader_version이 낮아서 생기는 이슈. https://github.com/facebook/SoLoader/issues/74#issuecomment-969307465 참고(shout out to hardy!)

profile
'과연 이게 최선일까?' 끊임없이 생각하기

0개의 댓글