Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

React Native 0.71 compatibility is required #195

Open
SomaKishimoto opened this issue Feb 7, 2023 · 10 comments
Open

React Native 0.71 compatibility is required #195

SomaKishimoto opened this issue Feb 7, 2023 · 10 comments
Labels
✨ enhancement New feature or request 🆘 help wanted Extra attention is needed

Comments

@SomaKishimoto
Copy link

Version

0.2.4

Problem Area

react-native-pytorch-core (core package)

Steps to Reproduce

Create empty project

$ npx react-native init AwesomeTSProject
$ cd AwesomeTSProject 

Add PlayTorch to Existing App

$ yarn add react-native-pytorch-core

Additional steps on Android

  • rewrite ./android/gradle.properties and ./android/app/build.gradle
    Running
$ npx react-native start
$ npx react-native run-android

Expected Results

I expect the build to complete and the Android emulator to launch, but the following error occurs.

BUILD FAILED in 1m 14s

Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* Where:
Build file '/AwesomeTSProject/node_modules/react-native-pytorch-core/android/build.gradle' line: 132

* What went wrong:
A problem occurred evaluating project ':react-native-pytorch-core'.
> Expected directory '/AwesomeTSProject/android/../node_modules/react-native/android' to contain exactly one file, however, it contains no files.

This is likely related to a significant fix regarding RNGP that occurred in React Native 0.71.

I attempted to modify the CMake files of react-native-pytorch-core, taking reference from the React Native 0.71 compatibility implementation carried out by react-native-vision-camera.
However, the build failed due to compatibility issues with the fbjni 0.2.2 version.

If there is anything I can do to help, please let me know.

Code example, screenshot, or link to repository

No response

@raedle
Copy link
Contributor

raedle commented Feb 8, 2023

@SomaKishimoto , yes, the recent changes in RN 0.71 break compatibility with third-party libraries including react-native-pytorch-core. I think looking at how react-native-vision-camera upgraded support to 0.71 is a good approach.

The fbjni 0.2.2 comes with PyTorch Mobile 1.12. What's the exact issue with fbjni?

@raedle raedle added ✨ enhancement New feature or request 🆘 help wanted Extra attention is needed labels Feb 8, 2023
@SomaKishimoto
Copy link
Author

@raedle , I don't have knowledge about building React Native apps for Android, but could the inconsistency between FBJNI_VERSION and PlayTorch, as mentioned here, be an issue?

As a result of modifying the build-related files myself, the following error occurred.

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class com.facebook.jni.CppException found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.CppSystemErrorException found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.DestructorThread found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.DestructorThread$1 found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.DestructorThread$Destructor found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.DestructorThread$DestructorList found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.DestructorThread$DestructorStack found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.DestructorThread$Terminus found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.HybridClassBase found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.HybridData found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.HybridData$Destructor found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.IteratorHelper found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.MapIteratorHelper found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.NativeRunnable found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.ThreadScopeSupport found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.UnknownCppException found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.annotations.DoNotStrip found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     
     Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

The patch file is as attached. However, please be careful that the version of react-native-pytorch-core is 0.2.1.
react-native-pytorch-core+0.2.1.patch

Sorry for that I can only provide this data due to other issue.
I'm ready to provide the bug data of version 0.2.4 if needed.

@fencer-yd
Copy link

@SomaKishimoto , yes, the recent changes in RN 0.71 break compatibility with third-party libraries including react-native-pytorch-core. I think looking at how react-native-vision-camera upgraded support to 0.71 is a good approach.

The fbjni 0.2.2 comes with PyTorch Mobile 1.12. What's the exact issue with fbjni?

After I upgraded expo to version 48, I encountered an incompatibility problem with the fbjni version. Is this problem solved now?

@fencer-yd
Copy link

Has the compatibility problem of the rn71 version been resolved now? This question is very important to me.

@SomaKishimoto
Copy link
Author

@fencer-yd , it's not solved yet. I will try asking the PyTorch community about the fbjni version.

@SomaKishimoto
Copy link
Author

@fencer-yd , I asked about that problem on the PyTorch forum. I hope this will be the key to solving the problem.

@rhelck
Copy link

rhelck commented Mar 18, 2023

Had the exact same issue with expo app. Any known fixes or updates?

@fencer-yd
Copy link

Is this problem solved now?

@heejae-kwon
Copy link

When can I know this problem is solved?

@cauyyl
Copy link

cauyyl commented Sep 28, 2023

@raedle , I don't have knowledge about building React Native apps for Android, but could the inconsistency between FBJNI_VERSION and PlayTorch, as mentioned here, be an issue?

As a result of modifying the build-related files myself, the following error occurred.

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class com.facebook.jni.CppException found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.CppSystemErrorException found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.DestructorThread found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.DestructorThread$1 found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.DestructorThread$Destructor found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.DestructorThread$DestructorList found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.DestructorThread$DestructorStack found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.DestructorThread$Terminus found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.HybridClassBase found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.HybridData found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.HybridData$Destructor found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.IteratorHelper found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.MapIteratorHelper found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.NativeRunnable found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.ThreadScopeSupport found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.UnknownCppException found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     Duplicate class com.facebook.jni.annotations.DoNotStrip found in modules jetified-fbjni-0.3.0-runtime (com.facebook.fbjni:fbjni:0.3.0) and jetified-fbjni-java-only-0.2 (com.facebook.fbjni:fbjni-java-only:0.2.2)
     
     Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

The patch file is as attached. However, please be careful that the version of react-native-pytorch-core is 0.2.1. react-native-pytorch-core+0.2.1.patch

Sorry for that I can only provide this data due to other issue. I'm ready to provide the bug data of version 0.2.4 if needed.

when i add patch to my pure react native 0.72.4project, i am faceing [CXX1101] NDK at /Users/bishen/Library/Android/sdk/ndk/23.1.7779620 did not have a source.properties file, i have found a similar issue in react-native-reanimated here. But i have no idea to solve this error.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
✨ enhancement New feature or request 🆘 help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants