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

🐛 Error building: "2 files found with path 'lib/arm64-v8a/libfolly_runtime.so' from inputs" #1125

Closed
3 of 4 tasks
viniciusyoshioka opened this issue Jul 6, 2022 · 22 comments · Fixed by #1144
Closed
3 of 4 tasks
Labels
🐛 bug Something isn't working

Comments

@viniciusyoshioka
Copy link
Contributor

What were you trying to do?

I was trying to build the app

Reproduceable Code

No response

What happened instead?

The build fails

Relevant log output

> Task :app:mergeDebugNativeLibs FAILED
Execution optimizations have been disabled for task ':app:mergeDebugNativeLibs' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: '/home/user/Área de Trabalho/docscan/android/app/build/intermediates/merged_jni_libs/debug/out'. Reason: Task ':app:mergeDebugNativeLibs' uses this output of task ':app:copyDebugReactNativeVectorIconFonts' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.3.3/userguide/validation_problems.html#implicit_dependency for more details about this problem.

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

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings

Execution optimizations have been disabled for 8 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.
295 actionable tasks: 24 executed, 271 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction
   > 2 files found with path 'lib/arm64-v8a/libfolly_runtime.so' from inputs:
      - /home/user/Área de Trabalho/docscan/node_modules/react-native-vision-camera/android/build/intermediates/library_jni/debug/jni/arm64-v8a/libfolly_runtime.so
      - /home/user/.gradle/caches/transforms-3/1eed3d8d6e8f118b544df7150c917187/transformed/jetified-react-native-0.69.1-debug/jni/arm64-v8a/libfolly_runtime.so
     If you are using jniLibs and CMake IMPORTED targets, see
     https://developer.android.com/r/tools/jniLibs-vs-imported-targets

* 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.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction
   > 2 files found with path 'lib/arm64-v8a/libfolly_runtime.so' from inputs:
      - /home/user/Área de Trabalho/docscan/node_modules/react-native-vision-camera/android/build/intermediates/library_jni/debug/jni/arm64-v8a/libfolly_runtime.so
      - /home/user/.gradle/caches/transforms-3/1eed3d8d6e8f118b544df7150c917187/transformed/jetified-react-native-0.69.1-debug/jni/arm64-v8a/libfolly_runtime.so
     If you are using jniLibs and CMake IMPORTED targets, see
     https://developer.android.com/r/tools/jniLibs-vs-imported-targets

* 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.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m

    at makeError (/home/user/Área de Trabalho/docscan/node_modules/execa/index.js:174:9)
    at /home/user/Área de Trabalho/docscan/node_modules/execa/index.js:278:16
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async runOnAllDevices (/home/user/Área de Trabalho/docscan/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
    at async Command.handleAction (/home/user/Área de Trabalho/docscan/node_modules/react-native/node_modules/@react-native-community/cli/build/index.js:192:9)
info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Device

Samsung S20 FE (Android 12)

VisionCamera Version

2.13.5

Additional information

@viniciusyoshioka viniciusyoshioka added the 🐛 bug Something isn't working label Jul 6, 2022
@hahachiwah
Copy link

I also have this issue after installing the patch in #1118

@rvuyyuru1
Copy link

rvuyyuru1 commented Jul 12, 2022

found any solution for this ?

@viniciusyoshioka
Copy link
Contributor Author

found any solution for this ?

This patch worked for me react-native-vision-camera+2.13.5.txt

@GittiMcHub
Copy link

I first faced #1118
Then applied the patch and faced the error stated here.

I tried with 2.13.5 + patch and 2.14.0 + patch but doesn't work for me. I keep getting same error. Did you do anything else?

@GittiMcHub
Copy link

GittiMcHub commented Jul 28, 2022

@hahachiwah and @rvuyyuru1
I additionally applied this https://github.com/mrousavy/react-native-vision-camera/pull/1144/files
to myProject/node_modules/react-native-vision-camera/android/build.gradle

Build works now

@viniciusyoshioka
Copy link
Contributor Author

I first faced #1118 Then applied the patch and faced the error stated here.

I tried with 2.13.5 + patch and 2.14.0 + patch but doesn't work for me. I keep getting same error. Did you do anything else?

I forgot to specify, but this .patch is different than the one in this comment #1118 (comment), this only contains the changes related to pull requests #1144.

@babaiyu
Copy link

babaiyu commented Aug 17, 2022

Hi, this issue is still happen in my project from latest version "2.14.1".

  • react-native => "0.69.4"
  • react-native-vision-camera => "2.14.1"

@viniciusyoshioka
Copy link
Contributor Author

Hi @babaiyu
This issue was fixed, but wasn't released yet to npm. You can install it with: npm install https://github.com/mrousavy/react-native-vision-camera

@babaiyu
Copy link

babaiyu commented Aug 22, 2022

Hi @babaiyu This issue was fixed, but wasn't released yet to npm. You can install it with: npm install https://github.com/mrousavy/react-native-vision-camera

Thanks for the solution, @viniciusyoshioka
But after install from github url i got failed build from source. Could you teach me how to install library from github source?

What i do:

yarn add https://github.com/mrousavy/react-native-vision-camera
cd node_modules/react-native-vision-camera
yarn install && yarn build

And finally i got this error

src/Camera.tsx:476:8 - error TS2786: 'NativeCameraView' cannot be used as a JSX component.
  Its instance type 'Component<NativeCameraViewProps, {}, any> & Readonly<NativeMethods>' is not a valid JSX element.
    The types returned by 'render()' are incompatible between these types.
      Type 'React.ReactNode' is not assignable to type 'import("/home/babaiyu/Desktop/personal/simponi-app/node_modules/@types/react/index").ReactNode'.
        Type '{}' is not assignable to type 'ReactNode'.

476       <NativeCameraView
           ~~~~~~~~~~~~~~~~


Found 1 error in src/Camera.tsx:476

✖ Failed to build definition files.
bob build

@viniciusyoshioka
Copy link
Contributor Author

Could you teach me how to install library from github source?

Hi, of course!
To install the library using GitHub I ran:

npm install https://github.com/mrousavy/react-native-vision-camera
npx react-native run-android

Thats what I did and it worked for me. I think is not needed to build from source manually.

@kicksent
Copy link

kicksent commented Sep 1, 2022

I have never installed packages via github. Does this work for production builds too? When will this be updated on npm so we can use the traditional installation method? @viniciusyoshioka Thanks!!

EDIT:
After deleting my node_modules and yarn.lock and reinstalling, I don't have this problem anymore.

@marsakt
Copy link

marsakt commented Sep 6, 2022

Hi @viniciusyoshioka,

I would like to ask you about the status, I have the latest versions of packages, but still I have this issue, when I tried to build the application. I am using EXPO and the error is:

[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:mergeReleaseNativeLibs'.
[stderr] > A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction
[stderr] > 2 files found with path 'lib/arm64-v8a/libfolly_runtime.so' from inputs:
[stderr] - /home/expo/workingdir/build/node_modules/react-native-vision-camera/android/build/intermediates/library_jni/release/jni/arm64-v8a/libfolly_runtime.so
[stderr] - /home/expo/.gradle/caches/transforms-3/04cf608f9945247f5366e97511924550/transformed/jetified-react-native-0.69.5-release/jni/arm64-v8a/libfolly_runtime.so
[stderr] If you are using jniLibs and CMake IMPORTED targets, see
[stderr] https://developer.android.com/r/tools/jniLibs-vs-imported-targets
[stderr] * Try:
[stderr] > Run with --stacktrace option to get the stack trace.
[stderr] > Run with --info or --debug option to get more log output.
[stderr] > Run with --scan to get full insights.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 12m 11s

"react-native": "0.69.5",
"react-native-vision-camera": "^2.14.1",
"expo": "~46.0.9",
"expo-camera": "~12.3.0",
"expo-dev-client": "~1.2.1",
"expo-file-system": "~14.1.0",
"expo-image-manipulator": "~10.4.0",
"expo-image-picker": "~13.3.1",
"expo-location": "~14.3.0",
"expo-media-library": "~14.2.0",
"expo-modules-core": "~0.11.5",
"expo-sensors": "~11.4.0",
"expo-splash-screen": "~0.16.2",
"expo-status-bar": "~1.4.0",
"expo-structured-headers": "^2.2.1",
"eas-cli": "2.1.0",
"expo-cli": "6.0.5",

I got the same error in EXPO Cloud & also locally when I try to build application.

Any suggestion how to fix this error?

Thank you very much !!

@marsakt
Copy link

marsakt commented Sep 6, 2022

Hi,

ok, so it seems that I found the solution for that, it is recommended solution for this kind of the issue:

I have to use:

  • "expo-build-properties": "~0.3.0"

then I had to add following recommended configuration::

  • app.json

{
"expo": {
...
"plugins": [
...
"expo-build-properties",
{
"android": {
"packagingOptions": {
"pickFirst": [
"/armeabi-v7a/libfolly_runtime.so",
"
/x86/libfolly_runtime.so",
"/arm64-v8a/libfolly_runtime.so",
"
/x86_64/libfolly_runtime.so"
]
}
}
}
]

after that I was able to make a build.

@viniciusyoshioka
Copy link
Contributor Author

Hi @viniciusyoshioka,

I would like to ask you about the status, I have the latest versions of packages, but still I have this issue, when I tried to build the application. I am using EXPO and the error is:

[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:mergeReleaseNativeLibs'.
[stderr] > A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction
[stderr] > 2 files found with path 'lib/arm64-v8a/libfolly_runtime.so' from inputs:
[stderr] - /home/expo/workingdir/build/node_modules/react-native-vision-camera/android/build/intermediates/library_jni/release/jni/arm64-v8a/libfolly_runtime.so
[stderr] - /home/expo/.gradle/caches/transforms-3/04cf608f9945247f5366e97511924550/transformed/jetified-react-native-0.69.5-release/jni/arm64-v8a/libfolly_runtime.so
[stderr] If you are using jniLibs and CMake IMPORTED targets, see
[stderr] https://developer.android.com/r/tools/jniLibs-vs-imported-targets
[stderr] * Try:
[stderr] > Run with --stacktrace option to get the stack trace.
[stderr] > Run with --info or --debug option to get more log output.
[stderr] > Run with --scan to get full insights.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 12m 11s

"react-native": "0.69.5",
"react-native-vision-camera": "^2.14.1",
"expo": "~46.0.9",
"expo-camera": "~12.3.0",
"expo-dev-client": "~1.2.1",
"expo-file-system": "~14.1.0",
"expo-image-manipulator": "~10.4.0",
"expo-image-picker": "~13.3.1",
"expo-location": "~14.3.0",
"expo-media-library": "~14.2.0",
"expo-modules-core": "~0.11.5",
"expo-sensors": "~11.4.0",
"expo-splash-screen": "~0.16.2",
"expo-status-bar": "~1.4.0",
"expo-structured-headers": "^2.2.1",
"eas-cli": "2.1.0",
"expo-cli": "6.0.5",

I got the same error in EXPO Cloud & also locally when I try to build application.

Any suggestion how to fix this error?

Thank you very much !!

Hi!
react-native-vision-camera version 2.14.1 doesn't contain the fix for this issue. It wasn't released yet. To use it you can install the library from its repository with npm install https://github.com/mrousavy/react-native-vision-camera

And i think the configuration in app.json can be removed after that

@marsakt
Copy link

marsakt commented Sep 6, 2022

sorry for stupid qeustion, I see here #1144 that it was merge. Can I find somewhere when and possibly in which version it will be released ??

Thank you

@Productivix
Copy link

hi, if that can help :
I have this failure, but only on Linux , not on Windows 10.
I have this message exactly:
`A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction

2 files found with path 'lib/arm64-v8a/libfolly_runtime.so' from inputs:
- /myhome/dev_RN-Node-sauv-GIT/test_rn_qrscan/node_modules/react-native-vision-camera/android/build/intermediates/library_jni/debug/jni/arm64-v8a/libfolly_runtime.so
- /myhome/.gradle/caches/transforms-3/df0743fddd24fb4ce9da9c85e374cb8b/transformed/jetified-react-native-0.70.0-debug/jni/arm64-v8a/libfolly_runtime.so
If you are using jniLibs and CMake IMPORTED targets, see
https://developer.android.com/r/tools/jniLibs-vs-imported-targets`

I have on both machines this config :
"dependencies": { "react": "18.1.0", "react-native": "0.70.0", "react-native-reanimated": "^2.10.0", "react-native-vision-camera": "^2.14.1", "vision-camera-code-scanner": "^0.2.0" }, "devDependencies": { "@babel/core": "^7.12.9", "@babel/runtime": "^7.12.5", "@react-native-community/eslint-config": "^2.0.0", "babel-jest": "^26.6.3", "eslint": "^7.32.0", "jest": "^26.6.3", "metro-react-native-babel-preset": "^0.72.1", "react-test-renderer": "18.1.0" },

@Productivix
Copy link

Productivix commented Sep 13, 2022

After reading the link https://developer.android.com/r/tools/jniLibs-vs-imported-targets`
I think the issue comes from the line 137 of buid.gradle of the module (react-native-vision-camera)
with :

if (ENABLE_FRAME_PROCESSORS) { externalNativeBuild { cmake { cppFlags "-fexceptions", "-frtti", "-std=c++1y", "-DONANDROID" abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a' arguments '-DANDROID_STL=c++_shared', "-DREACT_NATIVE_VERSION=${REACT_NATIVE_VERSION}", "-DNODE_MODULES_DIR=${nodeModules}", "-DFOR_HERMES=${FOR_HERMES}", "-DJS_RUNTIME_DIR=${jsRuntimeDir}" }

and ../node_modules/react-native-vision-camera/android/CMakeLists.txt , after line 13 (reference to RN V66 ... quite old?

@Productivix
Copy link

solved by :
software-mansion/react-native-reanimated#3342 (comment)

@RRaideRR
Copy link

Unfortunately, I run into that issue as well.

I'm using expo with the following dependencies.

"expo": "~46.0.16",
"react-native": "0.69.6",
"react-native-vision-camera": "^2.14.1",

Running expo prebuild works on my machine. However, the eas cloud build fails with the above mentioned error.

I also tried to add the following to my app.json - still the same behavior (prebuild works, eas cloud build fails)

      ["expo-build-properties",
        {
          "android": {
            "packagingOptions": {
              "pickFirst": [
                "/armeabi-v7a/libfolly_runtime.so",
                "/x86/libfolly_runtime.so",
                "/arm64-v8a/libfolly_runtime.so",
                "/x86_64/libfolly_runtime.so"
              ]
            }
          }
        }
      ],

Anyone has a helping hand here?

@mikedepeel-movista
Copy link

mikedepeel-movista commented Oct 21, 2022

We've run into this on linux dev machines as well, and while installing from github works around the issue, then it breaks the running of jest mock, etc.

Is the intent to get this fix in a release, or is it just a temporary fix and we're waiting on something else?

Thanks for the work on this, no pressure intended by any means, only looking to better understand the situation.

@Productivix
Copy link

hi,
on Linux , and Windows,
with only the stack :
"react": "18.1.0", "react-native": "0.70.3", "react-native-vision-camera": "^2.14.1"
I mean without Reanimated ,(I removed the plugin)
I have removed the added lines of packagingOptions in app/build.gradle.
and no problems to build.
hope it helps

@mayeyun
Copy link

mayeyun commented Dec 13, 2023

没有人能解决这个问题,不知道react-native官方能否解决这个问题!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.