react-native-vision-camera: 🐛 Error building in 0.69.1: "Expected directory 'node_modules/react-native/android' to contain exactly one file, however, it contains more than one file"
What were you trying to do?
After upgrading react-native from 0.68.2 to 0.69.1, I try to build to test if there was no erros in the upgrade.
Reproduceable Code
No response
What happened instead?
The build failed. Even after update the library to the latest version, the error continued.
Relevant log output
> Configure project :react-native-vision-camera
VisionCamera: node_modules/ found at: /home/user/Área de Trabalho/docscan/node_modules
VisionCamera: Building with Hermes...
Warning: The 'kotlin-android-extensions' Gradle plugin is deprecated. Please use this migration guide (https://goo.gle/kotlin-android-extensions-deprecation) to start working with View Binding (https://developer.android.com/topic/libraries/view-binding) and the 'kotlin-parcelize' plugin.
VisionCamera: Frame Processors are enabled! Building C++ part...
WARNING:DSL element 'dexOptions' is obsolete and should be removed.
It will be removed in version 8.0 of the Android Gradle plugin.
Using it has no effect, and the AndroidGradle plugin optimizes dexing automatically.
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
6 actionable tasks: 6 up-to-date
FAILURE: Build failed with an exception.
* Where:
Build file '/home/user/Área de Trabalho/docscan/node_modules/react-native-vision-camera/android/build.gradle' line: 231
* What went wrong:
A problem occurred evaluating project ':react-native-vision-camera'.
> Expected directory '/home/user/Área de Trabalho/docscan/node_modules/react-native/android' to contain exactly one file, however, it contains more than one file.
* 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 11s
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.
* Where:
Build file '/home/user/Área de Trabalho/docscan/node_modules/react-native-vision-camera/android/build.gradle' line: 231
* What went wrong:
A problem occurred evaluating project ':react-native-vision-camera'.
> Expected directory '/home/user/Área de Trabalho/docscan/node_modules/react-native/android' to contain exactly one file, however, it contains more than one file.
Device
Samsung S20 FE (Android 12)
VisionCamera Version
2.13.1 and 2.13.5
Additional information
- I am using Expo
- I have read the Troubleshooting Guide
- I agree to follow this project’s Code of Conduct
- I searched for similar issues in this repository and found none.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 15 (1 by maintainers)
Thank you for the patch @psycheangel!
@sinfrid and anyone else who wants to use this patch: you need to put the patch a folder called
patches
in the root of your project, install patch-package, and then runnpx patch-package
to apply the patch.For instance, if the txt file were saved to
~/Downloads
:rename the file to react-native-vision-camera+2.13.5.patch use patch-package library
How to apply the patch?
Hi,
you could wait for this PR to merge #1116
or use a patch from the attachment react-native-vision-camera+2.13.5.txt
Still have the issue. Project: React Native - 0.69.1 React Native Vision Camera - 2.14.0 React Native Reanimated - 2.9.1
Edit: I’m also using a plugin - Vision Camera Code Scanner - 2.14.1
@jimshidbachu I got a solution to this new error and the .patch to fix it is here https://github.com/mrousavy/react-native-vision-camera/issues/1125#issuecomment-1183987100
BTW, I’ts works in the last version of react native/react-native-vision-camera. Thank you!
React Native - 0.69.3 React Native Vision Camera - 2.14.0 React Native Reanimated - 2.9.1
Same issue, could someone take a look, please?