React Native 버전 업그레이드 시 기존에 사용하던 라이브러리의 conflict 그 외 여러 설정 파일 변경으로 에러가 많이 발생했다.
에러가 발생했을 때 해당 에러의 원인을 최대한 이해한 뒤에 해결 방법을 적용하려고 노력했다.
에러
No visible @interface for 'RCTBundleURLProvider' declares the selector 'jsBundleURLForBundleRoot:fallbackResource:'
원인
jsBundleURLForBundle Root 가 버전이 올라가면서 사라짐
해결
에러가 나는 코드 아래와 같이 변경
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
에러
Babel plugin exception: Error: Unknown node type: "TSInstantiationExpression”
원인
패키지 버전 변경 후 제대로 적용 안됨
해결
캐시 reset 후 pod install
yarn start —reset-cache
cd ios && pod install && cd ..
에러
앱 reload 시 에러 발생
원인
- code push 에서 발생하는 에러
-realm-js에서 이미 destroy된 object를 계속 참조하면서 memory leakage 버그 발생
해결
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if target.name == 'React-jsi'
puts '*** Patching React-jsi pod...'
puts '***'
puts '*** - Adding NDEBUG=1 to silence the \'JSCRuntime destroyed with a dangling API object\''
puts '*** crash upon reload.'
puts '***'
puts '*** This is caused by realm-js being loaded at runtime, when CodePush tries to'
puts '*** reload the app. It\'s recommended to remove realm-js. After which this'
puts '*** workaround can be removed from Podfile.'
puts '***'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'NDEBUG=1'
puts '*** Done'
puts '***'
end
end
end
end
출처
https://github.com/microsoft/react-native-code-push/issues/2179#issuecomment-1006036747
에러
A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
Android resource linking failed
해결
android/app/src/main/res/drawable/rn_edit_text_material.xml에 아래 코드 추가
<?xml version="1.0" encoding="utf-8"?> <inset xmlns:android="http://schemas.android.com/apk/res/android" android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material" android:insetRight="@dimen/abc_edit_text_inset_horizontal_material" android:insetTop="@dimen/abc_edit_text_inset_top_material" android:insetBottom="@dimen/abc_edit_text_inset_bottom_material"> <selector> </selector> </inset>
출처
https://github.com/facebook/react-native/issues/35348
Android resource linking failed · Issue #35348 · facebook/react-native
Description A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction Android resource linking failed ERROR:D:\project\android\app\buil...
github.com
에러
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 ~/node_modules/@react-native-community/cameraroll/android/src/main/java/com/reactnativecommunity/cameraroll/CameraRollModule.java:650: error: unreported exception IOException; must be caught or declared to be thrown retriever.release(); ^ ~/node_modules/@react-native-community/cameraroll/android/src/main/java/com/reactnativecommunity/cameraroll/CameraRollModule.java:713: error: unreported exception IOException; must be caught or declared to be thrown retriever.release(); ^ Note: ~/node_modules/@react-native-community/cameraroll/android/src/main/java/com/reactnativecommunity/cameraroll/CameraRollModule.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 2 errors
해결
@react-native-community/cameraroll/android/src/main/java/com/reactnativecommunity/cameraroll/CameraRollModule.java 파일에
retriever.release() 코드를 아래와 같이 변경
try {
retriever.release();
} catch (IOException ex) {
// handle the exception here
}
출처
https://github.com/facebook/react-native/issues/35348
Android resource linking failed · Issue #35348 · facebook/react-native
Description A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction Android resource linking failed ERROR:D:\project\android\app\buil...
github.com
에러
Build fails on Android with: Cannot find symbol com.swmansion.reanimated.ReanimatedJSIModulePackage
원인
MainApplication.java에 ReanimatedJSIModulePackage가 더 이상 필요하지 않아 import하면 에러 발생
해결
ReanimatedJSIModulePackage import 제거
출처
https://github.com/software-mansion/react-native-reanimated/issues/2310
Build fails on Android with: Cannot find symbol com.swmansion.reanimated.ReanimatedJSIModulePackage · Issue #2310 · software-m
Description I try to build an Android Project. The Gradle Build works without an error. However, when I try to run the app on the device, I get an Error. Expected behavior I want the app to start o...
github.com
'Develop > React Natvie' 카테고리의 다른 글
[React Native]0.66.2에서 0.72로 버전 업그레이드 - 1 (업그레이드 하기) (2) | 2024.08.14 |
---|