Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing support for React Native 0.74 #221

Closed
MrRefactor opened this issue Mar 12, 2024 · 5 comments · Fixed by #358
Closed

Missing support for React Native 0.74 #221

MrRefactor opened this issue Mar 12, 2024 · 5 comments · Fixed by #358

Comments

@MrRefactor
Copy link
Contributor

Hey, while working on an upgrade to react-native 0.74.0-rc.2 I have build errors related to use of deprecated Gradle features.

Confirmed on fresh react native app with rn-0.74.0-rc.2

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

/App/node_modules/@expensify/react-native-live-markdown/android/src/main/java/com/expensify/livemarkdown/MarkdownUtils.java:14: error: cannot find symbol
import com.facebook.react.views.text.CustomLineHeightSpan;
                                    ^
  symbol:   class CustomLineHeightSpan
  location: package com.facebook.react.views.text
/App/node_modules/@expensify/react-native-live-markdown/android/src/main/java/com/expensify/livemarkdown/MarkdownUtils.java:144: error: cannot find symbol
        CustomLineHeightSpan[] spans = ssb.getSpans(0, ssb.length(), CustomLineHeightSpan.class);
        ^
  symbol:   class CustomLineHeightSpan
  location: class MarkdownUtils
/App/node_modules/@expensify/react-native-live-markdown/android/src/main/java/com/expensify/livemarkdown/MarkdownUtils.java:144: error: cannot find symbol
        CustomLineHeightSpan[] spans = ssb.getSpans(0, ssb.length(), CustomLineHeightSpan.class);
                                                                     ^
  symbol:   class CustomLineHeightSpan
  location: class MarkdownUtils
Note: /App/node_modules/@expensify/react-native-live-markdown/android/src/main/java/com/expensify/livemarkdown/MarkdownFontFamilySpan.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
3 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':expensify_react-native-live-markdown:compileDebugJavaWithJavac'.
@tomekzaw
Copy link
Collaborator

Thanks @MrRefactor for reporting this issue. I confirm this is reproducible on my end. Working on a fix.

@tomekzaw
Copy link
Collaborator

Workaround

Apply the following change in android/src/main/java/com/expensify/livemarkdown/MarkdownUtils.java:

-import com.facebook.react.views.text.CustomLineHeightSpan;
+import com.facebook.react.views.text.internal.span.CustomLineHeightSpan;

@alantoa
Copy link

alantoa commented May 10, 2024

Hey @tomekzaw, thanks! This change work for me. Do we have a plan to release a version that includes this fix in RN 0.74+?

@MrRefactor MrRefactor changed the title Missing support for rn 0.74RC Missing support for rn 0.74 May 24, 2024
@MrRefactor
Copy link
Contributor Author

Hey @tomekzaw

It seems there are more build issues on rn0.74, we have also reproduced those on example app in the library upgrading it to rn 0.74 and enabling new arch:

  FAILED: /App/android/app/build/intermediates/cxx/Debug/4r2x36fq/obj/x86_64/libreact_codegen_RNLiveMarkdownSpec.so
  : && /Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=x86_64-none-linux-android23 --sysroot=/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security   -fno-limit-debug-info  -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--no-undefined-version -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libreact_codegen_RNLiveMarkdownSpec.so -o /App/android/app/build/intermediates/cxx/Debug/4r2x36fq/obj/x86_64/libreact_codegen_RNLiveMarkdownSpec.so RNLiveMarkdownSpec_autolinked_build/CMakeFiles/react_codegen_RNLiveMarkdownSpec.dir/MarkdownCommitHook.cpp.o RNLiveMarkdownSpec_autolinked_build/CMakeFiles/react_codegen_RNLiveMarkdownSpec.dir/NativeProxy.cpp.o RNLiveMarkdownSpec_autolinked_build/CMakeFiles/react_codegen_RNLiveMarkdownSpec.dir/OnLoad.cpp.o RNLiveMarkdownSpec_autolinked_build/CMakeFiles/react_codegen_RNLiveMarkdownSpec.dir/RNLiveMarkdownSpec.cpp.o 'RNLiveMarkdownSpec_autolinked_build/CMakeFiles/react_codegen_RNLiveMarkdownSpec.dir//App/node_modules/@expensify/react-native-live-markdown/cpp/react/renderer/components/RNLiveMarkdownSpec/MarkdownShadowFamilyRegistry.cpp.o' 'RNLiveMarkdownSpec_autolinked_build/CMakeFiles/react_codegen_RNLiveMarkdownSpec.dir//App/node_modules/@expensify/react-native-live-markdown/cpp/react/renderer/components/RNLiveMarkdownSpec/MarkdownTextInputDecoratorShadowNode.cpp.o' 'RNLiveMarkdownSpec_autolinked_build/CMakeFiles/react_codegen_RNLiveMarkdownSpec.dir//App/node_modules/@expensify/react-native-live-markdown/android/build/generated/source/codegen/jni/react/renderer/components/RNLiveMarkdownSpec/ComponentDescriptors.cpp.o' 'RNLiveMarkdownSpec_autolinked_build/CMakeFiles/react_codegen_RNLiveMarkdownSpec.dir//App/node_modules/@expensify/react-native-live-markdown/android/build/generated/source/codegen/jni/react/renderer/components/RNLiveMarkdownSpec/EventEmitters.cpp.o' 'RNLiveMarkdownSpec_autolinked_build/CMakeFiles/react_codegen_RNLiveMarkdownSpec.dir//App/node_modules/@expensify/react-native-live-markdown/android/build/generated/source/codegen/jni/react/renderer/components/RNLiveMarkdownSpec/Props.cpp.o' 'RNLiveMarkdownSpec_autolinked_build/CMakeFiles/react_codegen_RNLiveMarkdownSpec.dir//App/node_modules/@expensify/react-native-live-markdown/android/build/generated/source/codegen/jni/react/renderer/components/RNLiveMarkdownSpec/RNLiveMarkdownSpecJSI-generated.cpp.o' 'RNLiveMarkdownSpec_autolinked_build/CMakeFiles/react_codegen_RNLiveMarkdownSpec.dir//App/node_modules/@expensify/react-native-live-markdown/android/build/generated/source/codegen/jni/react/renderer/components/RNLiveMarkdownSpec/ShadowNodes.cpp.o' 'RNLiveMarkdownSpec_autolinked_build/CMakeFiles/react_codegen_RNLiveMarkdownSpec.dir//App/node_modules/@expensify/react-native-live-markdown/android/build/generated/source/codegen/jni/react/renderer/components/RNLiveMarkdownSpec/States.cpp.o'  /App/node_modules/react-native/ReactAndroid/.cxx/Debug/i0614r3o/x86_64/ReactCommon/react/renderer/components/text/librrc_text.a  /App/node_modules/react-native/ReactAndroid/.cxx/Debug/i0614r3o/x86_64/ReactCommon/react/renderer/components/textinput/librrc_textinput.a  /App/node_modules/react-native/ReactAndroid/.cxx/Debug/i0614r3o/x86_64/ReactCommon/react/renderer/textlayoutmanager/libreact_render_textlayoutmanager.a  /App/node_modules/react-native/ReactAndroid/build/intermediates/cxx/Debug/i0614r3o/obj/x86_64/libreact_render_imagemanager.so  /App/node_modules/react-native/ReactAndroid/build/intermediates/cxx/Debug/i0614r3o/obj/x86_64/libfabricjni.so  /.gradle/caches/transforms-4/23e5685106e37cb0943ed69f62cea787/transformed/jetified-fbjni-0.6.0/prefab/modules/fbjni/libs/android.x86_64/libfbjni.so  /App/node_modules/react-native/ReactAndroid/build/intermediates/cxx/Debug/i0614r3o/obj/x86_64/libfolly_runtime.so  
  /App/node_modules/react-native/ReactAndroid/build/intermediates/cxx/Debug/i0614r3o/obj/x86_64/libglog.so  /App/node_modules/react-native/ReactAndroid/build/intermediates/cxx/Debug/i0614r3o/obj/x86_64/libjsi.so  /App/node_modules/react-native/ReactAndroid/build/intermediates/cxx/Debug/i0614r3o/obj/x86_64/libreact_codegen_rncore.so  /App/node_modules/react-native/ReactAndroid/build/intermediates/cxx/Debug/i0614r3o/obj/x86_64/libreact_debug.so  /App/node_modules/react-native/ReactAndroid/build/intermediates/cxx/Debug/i0614r3o/obj/x86_64/libreact_nativemodule_core.so  /App/node_modules/react-native/ReactAndroid/build/intermediates/cxx/Debug/i0614r3o/obj/x86_64/libreact_render_core.so  /App/node_modules/react-native/ReactAndroid/build/intermediates/cxx/Debug/i0614r3o/obj/x86_64/libreact_render_debug.so  /App/node_modules/react-native/ReactAndroid/build/intermediates/cxx/Debug/i0614r3o/obj/x86_64/libreact_render_graphics.so  /App/node_modules/react-native/ReactAndroid/build/intermediates/cxx/Debug/i0614r3o/obj/x86_64/libreact_render_mapbuffer.so  /App/node_modules/react-native/ReactAndroid/.cxx/Debug/i0614r3o/x86_64/ReactCommon/react/renderer/uimanager/libreact_render_uimanager.a  /App/node_modules/react-native/ReactAndroid/.cxx/Debug/i0614r3o/x86_64/ReactCommon/react/renderer/scheduler/libreact_render_scheduler.a  /App/node_modules/react-native/ReactAndroid/build/intermediates/cxx/Debug/i0614r3o/obj/x86_64/libreact_utils.so  /App/node_modules/react-native/ReactAndroid/build/intermediates/cxx/Debug/i0614r3o/obj/x86_64/libruntimeexecutor.so  /App/node_modules/react-native/ReactAndroid/build/intermediates/cxx/Debug/i0614r3o/obj/x86_64/librrc_view.so  /App/node_modules/react-native/ReactAndroid/build/intermediates/cxx/Debug/i0614r3o/obj/x86_64/libturbomodulejsijni.so  /App/node_modules/react-native/ReactAndroid/build/intermediates/cxx/Debug/i0614r3o/obj/x86_64/libyoga.so  -landroid  -llog  -latomic -lm && :
  ld.lld: error: undefined symbol: facebook::react::JReadableMapBuffer::createWithContents(facebook::react::MapBuffer&&)
  >>> referenced by TextLayoutManager.cpp:136 (/App/node_modules/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/android/react/renderer/textlayoutmanager/TextLayoutManager.cpp:136)
  >>>               TextLayoutManager.cpp.o:(facebook::react::measureAndroidComponentMapBuffer(std::__ndk1::shared_ptr<facebook::react::ContextContainer const> const&, int, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>> const&, facebook::react::MapBuffer, facebook::react::MapBuffer, float, float, float, float, _jfloatArray*)) in archive /App/node_modules/react-native/ReactAndroid/.cxx/Debug/i0614r3o/x86_64/ReactCommon/react/renderer/textlayoutmanager/libreact_render_textlayoutmanager.a
  >>> referenced by TextLayoutManager.cpp:137 (/App/node_modules/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/android/react/renderer/textlayoutmanager/TextLayoutManager.cpp:137)
  >>>               TextLayoutManager.cpp.o:(facebook::react::measureAndroidComponentMapBuffer(std::__ndk1::shared_ptr<facebook::react::ContextContainer const> const&, int, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>> const&, facebook::react::MapBuffer, facebook::react::MapBuffer, float, float, float, float, _jfloatArray*)) in archive /App/node_modules/react-native/ReactAndroid/.cxx/Debug/i0614r3o/x86_64/ReactCommon/react/renderer/textlayoutmanager/libreact_render_textlayoutmanager.a
  >>> referenced by TextLayoutManager.cpp:257 (/App/node_modules/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/android/react/renderer/textlayoutmanager/TextLayoutManager.cpp:257)
  >>>               TextLayoutManager.cpp.o:(facebook::react::TextLayoutManager::measureLines(facebook::react::AttributedString const&, facebook::react::ParagraphAttributes const&, facebook::react::Size) const) in archive /App/node_modules/react-native/ReactAndroid/.cxx/Debug/i0614r3o/x86_64/ReactCommon/react/renderer/textlayoutmanager/libreact_render_textlayoutmanager.a
  >>> referenced 1 more times

  ld.lld: error: undefined symbol: facebook::react::NativeArray::consume()
  >>> referenced by TextLayoutManager.cpp:268 (/App/node_modules/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/android/react/renderer/textlayoutmanager/TextLayoutManager.cpp:268)
  >>>               TextLayoutManager.cpp.o:(facebook::react::TextLayoutManager::measureLines(facebook::react::AttributedString const&, facebook::react::ParagraphAttributes const&, facebook::react::Size) const) in archive /App/node_modules/react-native/ReactAndroid/.cxx/Debug/i0614r3o/x86_64/ReactCommon/react/renderer/textlayoutmanager/libreact_render_textlayoutmanager.a
  clang++: error: linker command failed with exit code 1 (use -v to see invocation)

@tomekzaw
Copy link
Collaborator

tomekzaw commented May 27, 2024

Should be fixed with #358.

Don't forget to apply patch to react-native and build it from sources.

@tomekzaw tomekzaw changed the title Missing support for rn 0.74 Missing support for React Native 0.74 Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants