Open mpinter opened 1 month ago
The error is User is using a static STL but library requires a shared STL
Can you give this a try? https://github.com/google/oboe/commit/583c0af778c5f374297f56a7af181bf04a924229
From the ChatGPT
The error you’re seeing is related to a mismatch between the expected type of Standard Template Library (STL) the project is using (static vs shared) when building native code. Specifically, the message indicates that the user is using a static STL, but the library ReactAndroid/fabricjni requires a shared STL.
Here are some steps you can take to try to resolve this issue:
Modify CMakeLists.txt to Use Shared STL:Open the CMakeLists.txt file in the directory given (node_modules/@gutenye/ocr-react-native/android/CMakeLists.txt) and explicitly set the STL type to be shared: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DANDROID_STL=c++_shared")
Modify build.gradle to Support Shared STL:If modifying the CMakeLists.txt doesn’t resolve the issue, you can also set the STL type in your build.gradle file. In your app’s build.gradle file, under the android block, add the following line: android { externalNativeBuild { cmake { // Add this line to enable shared STL arguments "-DANDROID_STL=c++_shared" } } }
Check Dependencies:Make sure that all dependencies are correctly set up to use the same type of STL. Sometimes, third-party libraries might create conflicts if they’re built with different STL configurations.
Clean and Rebuild:It’s always a good practice to clean the project and try rebuilding it after making changes to configuration files. You can do this by running: cd android ./gradlew clean cd .. npx expo run:android
Update Dependencies:Ensure that all dependencies are up-to-date, including the expo and react-native SDKs, as updates often fix compatibility issues. You can update the dependencies using: npm install -g expo-cli expo upgrade
Use Debugging Options:If the problem persists, get more detailed logs by running Gradle with the --info or --stacktrace option to better understand where the conflict arises: npx expo run:android --info
By following these steps, you should be able to mitigate or resolve the STL conflict and proceed with the build. If the issue still exists, refer to the relevant documentation or reach out to the community for more specific guidance.
Hello. Thanks for the project, I'm trying to get the example running locally on Android. The error I've been stuck with is the following:
Entire log:
Can you please help me with getting the react native (expo) example running on Android device ? Thanks a lot in advance.
Note: had to make a few edits to library code before I got to this error - i.e. there is a release url referenced in gradle which was no longer valid and was replaced with
https://github.com/nihui/opencv-mobile/releases/download/v27/opencv-mobile-4.9.0-android.zip
. These seem harmless enough but if you'd like to see them as well happy to provide.Note2: as farbic is mentioned in error, I tried to run the same code but toggling the "newArchitecture" option in gradle.options to true - this fails elsewhere.