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 compiling VisionCameraProxy.kt in react-native 0.74.0 #2783

Closed
3 of 5 tasks
aardvarkk opened this issue Apr 22, 2024 · 16 comments
Closed
3 of 5 tasks

🔧 Error compiling VisionCameraProxy.kt in react-native 0.74.0 #2783

aardvarkk opened this issue Apr 22, 2024 · 16 comments
Labels
🔧 build error Issue is related to building VisionCamera in your project

Comments

@aardvarkk
Copy link

aardvarkk commented Apr 22, 2024

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

@aardvarkk aardvarkk added the 🔧 build error Issue is related to building VisionCamera in your project label Apr 22, 2024
@mrousavy
Copy link
Owner

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: reactwg/react-native-new-architecture#167 (reply in thread)

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.

@mrousavy mrousavy changed the title 🔧 Error compiling VisionCameraProxy.kt in RN 0.74.0 on react-native-vision-camera version 4.0.1 🔧 Error compiling VisionCameraProxy.kt in react-native 0.74.0 Apr 22, 2024
@aardvarkk
Copy link
Author

Thanks for the quick response! For now I am downgrading back to 0.73.7. Enjoy your vacation!

@mrousavy
Copy link
Owner

Thanks!

@AlixH
Copy link

AlixH commented Apr 23, 2024

Well deserved rest, thank you for your work !

@mrousavy
Copy link
Owner

see #2614

@usyadav007

This comment has been minimized.

@hengkx
Copy link

hengkx commented May 6, 2024

Are there any other temporary solutions besides downgrading?

@mrousavy
Copy link
Owner

mrousavy commented May 6, 2024

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.

@danieloprado
Copy link
Contributor

Workaround: #2851 (comment)

@mrousavy
Copy link
Owner

mrousavy commented May 8, 2024

Hey - this is a duplicate of #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.

@mrousavy mrousavy closed this as completed May 8, 2024
@mrousavy
Copy link
Owner

mrousavy commented May 8, 2024

The workaround is fine as a patch btw if you need it to build on RN 74 now.

@BulilKhan77
Copy link

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

  1. cd android
  2. ./gradlew clean
  3. cd ..
  4. npx react-native start --reset-cache
  5. and in another terminal type , npm run android

Alternate Option

  1. type ./android/gradlew clean
  2. npx react-native start --reset-cache
  3. close everthing and type npm run android or npx react-native run-android

It works

@coderjinhui
Copy link

so why this information not in the document?

@mrousavy
Copy link
Owner

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.

@GeekyCoder25
Copy link

GeekyCoder25 commented May 23, 2024

I've added the lines for the patch but it still won't work, pls is there any workaround for this

image

@danieloprado
Copy link
Contributor

I've added the lines for the patch but it still won't work, pls is there any workaround for this

image

Remove the + before the @OptIn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔧 build error Issue is related to building VisionCamera in your project
Projects
None yet
Development

No branches or pull requests

9 participants