react-native-vision-camera
react-native-vision-camera copied to clipboard
🔧 Error compiling VisionCameraProxy.kt in react-native 0.74.0
How were you trying to build the app?
yarn android
Full build logs
e: file:///home/user/node_modules/react-native-vision-camera/android/src/main/java/com/mrousavy/camera/frameprocessors/VisionCameraProxy.kt:31:79 This API is provided only for React Native frameworks and not intended for general users. This API can change between minor versions in alignment with React Native frameworks and won't be considered a breaking change.
e: file:///home/user/node_modules/react-native-vision-camera/android/src/main/java/com/mrousavy/camera/frameprocessors/VisionCameraProxy.kt:36:19 This API is provided only for React Native frameworks and not intended for general users. This API can change between minor versions in alignment with React Native frameworks and won't be considered a breaking change.
e: file:///home/user/node_modules/react-native-vision-camera/android/src/main/java/com/mrousavy/camera/frameprocessors/VisionCameraProxy.kt:36:47 This API is provided only for React Native frameworks and not intended for general users. This API can change between minor versions in alignment with React Native frameworks and won't be considered a breaking change.
e: file:///home/user/node_modules/react-native-vision-camera/android/src/main/java/com/mrousavy/camera/frameprocessors/VisionCameraProxy.kt:75:73 This API is provided only for React Native frameworks and not intended for general users. This API can change between minor versions in alignment with React Native frameworks and won't be considered a breaking change. FAILURE: Build failed with an exception. * What went wrong:
Execution failed for task ':react-native-vision-camera:compileDebugKotlin'.
Project dependencies
"dependencies": {
"@aws-amplify/auth": "^5",
"@aws-amplify/storage": "^5",
"@react-native-async-storage/async-storage": "^1.23.1",
"@tanstack/react-query": "^4",
"axios": "^1.6.8",
"i18next": "^23.11.2",
"immer": "^10.0.4",
"lottie-react-native": "^6.7.2",
"moment-timezone": "^0.5.45",
"phosphor-react-native": "^2.0.0",
"react": "18.2.0",
"react-i18next": "^14.1.0",
"react-native": "0.74.0",
"react-native-barcode-builder": "^2.0.0",
"react-native-bluetooth-classic": "^1.73.0-rc.8",
"react-native-paper": "^5.12.3",
"react-native-signature-capture": "^0.4.12",
"react-native-svg": "^15.1.0",
"react-native-vision-camera": "^4.0.1",
"rn-fetch-blob": "^0.12.0",
"uuid": "^9.0.1",
"zustand": "^4.5.2"
},
VisionCamera Version
4.0.1
Target platforms
Android
Operating system
Linux
Can you build the VisionCamera Example app?
No, I cannot build the Example app either
Additional information
- [ ] I am using Expo
- [ ] I have enabled Frame Processors (react-native-worklets-core)
- [X] I have read the Troubleshooting Guide
- [X] I agree to follow this project's Code of Conduct
- [X] I searched for similar issues in this repository and found none.
VisionCamera does not yet support react-native 0.74.
I've been working sleeplessy the past few weeks to get VisionCamera 4.0.0 released which contains a full rewrite of the Android codebase and Skia Frame Processors, and now I'm off to a vacation for a week.
For react-native 0.74 I want to migrate VisionCamera to new arch (so TurboModule + Fabric + CodeGen), but this is a huge effort and also I am blocked: I have one prop (frameProcessor) which needs custom JSI conversion - I don't want the jsi::Function to be converted to an RCTDirectEventBlock, but rather to a custom type (RNWorklet).
I am not sure if that is supported by CodeGen/Fabric/TurboModules, so currently (for Bridge/Paper) I have a very nasty solution where I inject a global.setFrameProcessor(viewTag, frameProcessor) function.
More info: https://github.com/reactwg/react-native-new-architecture/discussions/167#discussioncomment-8938596
Once that is resolved or if facebook can give me any pointers on how I could implement this clean, I could try to migrate VisionCamera to new arch / react-native 0.74. But I don't know when I'm gonna do that.
If someone wants to pay me to get VisionCamera migrated to new arch / react-native 0.74, contact me on https://margelo.io.
Thanks for the quick response! For now I am downgrading back to 0.73.7. Enjoy your vacation!
Thanks!
Well deserved rest, thank you for your work !
see https://github.com/mrousavy/react-native-vision-camera/issues/2614
simply downgrade your react native version with npm install [email protected] from 0.74.0 and it really works 26-04-2024 after downgrade may be you have error like this: Error: Unable to resolve module react-native from D:\AmanPrint\index.js: react-native could not be found within the project or in these directories: node_modules 3 | */ 4 |
5 | import {AppRegistry} from 'react-native'; | ^ 6 | import App from './App'; 7 | import {name as appName} from './app.json';
then follow this step run commond cd android ./gradlew clean cd .. npx react-native start --reset-cache and another terminal npm run android
and it works
Are there any other temporary solutions besides downgrading?
Again, see #2614. react-native 0.74 is simply not yet supported by VisionCamera because it still uses the Bridge for other props that are not Frame Processor related.
If you need this, please sponsor the issue #2614 to accelerate the development of this. Otherwise I don't work on it, since I am still on react-native 0.73 with my apps.
Workaround: https://github.com/mrousavy/react-native-vision-camera/issues/2851#issuecomment-2099325462
Hey - this is a duplicate of https://github.com/mrousavy/react-native-vision-camera/issues/2614.
New architecture support (which also implies react-native 0.74 support) is tracked in that issue. If you need this, please sponsor the issue/fund the development of that major refactor/migration by donating to the Polar pool mentioned in the issue above.
Thank you.
The workaround is fine as a patch btw if you need it to build on RN 74 now.
The Best Solution is to simply downgrade your react native version otherwise you will stuck in a deep well and will not be able to escape. Just downgrade with npm install [email protected] from 0.74.0 and it really works 21-05-2024 > Just run these commands
- cd android
- ./gradlew clean
- cd ..
- npx react-native start --reset-cache
- and in another terminal type , npm run android
Alternate Option
- type ./android/gradlew clean
- npx react-native start --reset-cache
- close everthing and type npm run android or npx react-native run-android
It works
so why this information not in the document?
What document? I explained right here that VisionCamera doesn't work with RN 0.74 yet. Also there's a pinned issue about this on top of the issue page.
I've added the lines for the patch but it still won't work, pls is there any workaround for this
I've added the lines for the patch but it still won't work, pls is there any workaround for this
Remove the + before the @OptIn
