Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Unable to build with Vision Camera 3.0.0-rc4 #156

Open
DeveloperMCD opened this issue Aug 16, 2023 · 29 comments
Open

Unable to build with Vision Camera 3.0.0-rc4 #156

DeveloperMCD opened this issue Aug 16, 2023 · 29 comments

Comments

@DeveloperMCD
Copy link

I'm on React-Native 0.72.4, React-Native-Vision-Camera 3.0.0-rc4

Getting this error:

/home/matthew/dev/stackbayapp/node_modules/vision-camera-code-scanner/android/src/main/java/com/visioncameracodescanner/VisionCameraCodeScannerPlugin.java:40: error: VisionCameraCodeScannerPlugin is not abstract and does not override abstract method callback(Frame,ReadableNativeMap) in FrameProcessorPlugin
public class VisionCameraCodeScannerPlugin extends FrameProcessorPlugin {
^
/home/matthew/dev/stackbayapp/node_modules/vision-camera-code-scanner/android/src/main/java/com/visioncameracodescanner/VisionCameraCodeScannerPlugin.java:62: error: method does not override or implement a method from a supertype
@OverRide
^
/home/matthew/dev/stackbayapp/node_modules/vision-camera-code-scanner/android/src/main/java/com/visioncameracodescanner/VisionCameraCodeScannerPlugin.java:251: error: constructor FrameProcessorPlugin in class FrameProcessorPlugin cannot be applied to given types;
super("scanCodes");
^
required: no arguments
found: String
reason: actual and formal argument lists differ in length
/home/matthew/dev/stackbayapp/node_modules/vision-camera-code-scanner/android/src/main/java/com/visioncameracodescanner/VisionCameraCodeScannerPluginPackage.java:19: error: cannot find symbol
FrameProcessorPlugin.register(new VisionCameraCodeScannerPlugin());
^
symbol: method register(VisionCameraCodeScannerPlugin)
location: class FrameProcessorPlugin
4 errors

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':vision-camera-code-scanner:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

@marouane-edghoughi
Copy link

Currently facing the same problem, did you manage to solve it?

@tyanbiao
Copy link

Same error 😭

@DeveloperMCD
Copy link
Author

DeveloperMCD commented Aug 22, 2023

I'm still getting this error when I add vision-camera-code-scanner to my project, even though 3.0.0-rc5 (with the new react-native-worklets-core) builds fine for Android on my PC.

I'm even using the updated branch (from rkmackinnon), which is supposed to work with Vision Camera v3 (circa March 2023).
I think the recent major changes to v3 are causing a problem. Maybe?

What I'm using right now:
Vision Camera: 3.0.0-rc5
This plugin: https://www.npmjs.com/package/vision-camera-v3-barcode-scanner
React-Native-Worklets-Core: 0.2.0

@joacub
Copy link

joacub commented Aug 28, 2023

any advance in this ?

@marouane-edghoughi
Copy link

@DeveloperMCD Unfortunately, we're still facing the same issue even after using your v3 barcode scanner.

@DeveloperMCD
Copy link
Author

Yes, as I said in the OP, the updated fork which is supposed to work with the "March 2023 version" of Vision Camera v3 does not currently build. I tried RC3 and the latest RCs as well.

Someone's going to have to dig into the code and update it again, I guess.

Let's be clear; I didn't do any of the coding on this fork. I just grabbed RKMackinnon's fork so I could publish it to a public NPM registry (and thus easily include it in React Native projects).

Now the real hard work begins though -- someone needs to help fix this library (Vision Camera Code Scanner) which is been completely abandoned -- and apparently there are < 1 current contributors to this project: i.e., people who know the code and/or willing to contribute and/or have the skills to bring it up to speed.

@DeveloperMCD
Copy link
Author

DeveloperMCD commented Aug 29, 2023

I'll tell you what though: the MacKinnon fork is certainly the starting point you want to start from. It's the best version or collection of code for "Vision Camera Code Scanner" on the planet right now. It has all the fixes that currently exist somewhere. MacKinnon started out by bringing the whole thing up to speed with V3, albeit the March 2023 version. If you started from the original Vision Camera Code Scanner, you'd have a lot more work to do.

The problem is, there's more fixing to do now. But it's not like those needed fixes can be found completed in some other repository out there. No, that is work yet-to-be-done.

@mohammadgharouni
Copy link

any updates?

@Nanle21
Copy link

Nanle21 commented Sep 6, 2023

I'm still getting this error when I add vision-camera-code-scanner to my project, even though 3.0.0-rc5 (with the new react-native-worklets-core) builds fine for Android on my PC.

I'm even using the updated branch (from rkmackinnon), which is supposed to work with Vision Camera v3 (circa March 2023). I think the recent major changes to v3 are causing a problem. Maybe?

What I'm using right now: Vision Camera: 3.0.0-rc5 This plugin: https://www.npmjs.com/package/vision-camera-v3-barcode-scanner React-Native-Worklets-Core: 0.2.0

This doesn't seem to work also

@sabarinath-m
Copy link

sabarinath-m commented Sep 8, 2023

Facing the same issue here. any solution yet?
My vision Camera version - 3.0.0
I got this issue after upgrading from RN 0.71.10 to RN 0.72.4

@DeveloperMCD
Copy link
Author

Using RKMacKinnon's latest changes, I got everything to build successfully. However, when I try to use the library, I get some new errors now:

ERROR Error: Exception in HostFunction: java.lang.NullPointerException: getPlugin(name, options) must not be null, js engine: hermes
ERROR Error: Exception in HostFunction: java.lang.NullPointerException: getPlugin(name, options) must not be null, js engine: hermes
ERROR TypeError: Cannot read property 'scanBarcodes' of undefined

@DeveloperMCD
Copy link
Author

https://www.npmjs.com/package/vision-camera-v3-barcode-scanner

The readme is a bit out of date -- I renamed the package to "vision-camera-v3-barcode-scanner" when I published it publicly to NPM.

import {BarcodeFormat, useScanBarcodes, scanBarcodes} from 'vision-camera-v3-barcode-scanner';

@JackHull
Copy link

Still encountering this error.

@wangjh7
Copy link

wangjh7 commented Sep 13, 2023

same error

@wangjh7
Copy link

wangjh7 commented Sep 14, 2023

https://www.npmjs.com/package/vision-camera-v3-barcode-scanner

The readme is a bit out of date -- I renamed the package to "vision-camera-v3-barcode-scanner" when I published it publicly to NPM.

import {BarcodeFormat, useScanBarcodes, scanBarcodes} from 'vision-camera-v3-barcode-scanner';

I tried and it built successfully, Great Job!
I noticed that mrousavy/react-native-vision-camera#1466 (comment), __scanQRCodes(frame) is deprecated in v3, and I assume that the globals: ['__scanCodes'] config can be removed, right?

@chandubudda
Copy link

anyone have solution for this error, still facing error

@chandubudda
Copy link

VisionCamera: Frame Processors enabled!
CMake Error in CMakeLists.txt:
Imported target "react-native-worklets-core::rnworklets" includes
non-existent path

i am still geting this error while building android

@chandubudda
Copy link

https://www.npmjs.com/package/vision-camera-v3-barcode-scanner

The readme is a bit out of date -- I renamed the package to "vision-camera-v3-barcode-scanner" when I published it publicly to NPM.

import {BarcodeFormat, useScanBarcodes, scanBarcodes} from 'vision-camera-v3-barcode-scanner';

VisionCamera: Frame Processors enabled!
CMake Error in CMakeLists.txt:
Imported target "react-native-worklets-core::rnworklets" includes
non-existent path

i am still facing this issue

@agunbuhori
Copy link

same error

@manish0707
Copy link

same error

+1

@adelindanaila
Copy link

+1

@samcodeng
Copy link

check this out guys, react-native-vision-camera now does QR/Barcode scanning
https://www.react-native-vision-camera.com/docs/guides/code-scanning

@mgcrea
Copy link

mgcrea commented Oct 6, 2023

I've also just released a frame processor rebuilt for vision-camera 3+ that can do high (configurable) fps scanning and provides highlighting of detected barcodes out-of-the-box.

You can check a working demo on GitHub @mgcrea/vision-camera-barcode-scanner.

Hope it can help others.

@natemartins
Copy link

natemartins commented Oct 7, 2023

I've also just released a frame processor rebuilt for vision-camera 3+ that can do high (configurable) fps scanning and provides highlighting of detected barcodes out-of-the-box.

You can check a working demo on GitHub @mgcrea/vision-camera-barcode-scanner.

Hope it can help others.

Does this work on apps that use react-native-reanimated v3 and above? I have been stuck on getting this to work for the past 5 hours but no head way.

This is the error I'm getting

Execution failed for task ':react-native-vision-camera:buildCMakeDebug[arm64-v8a]'

UPDATE

I removed react-native-reanimated and retried. Same error.

@mgcrea
Copy link

mgcrea commented Oct 7, 2023

@natemartins I had android issues as well in the past but they went away, can you try the latest version v0.5.1 and see if you still encounter issues building vision-camera?

@manish0707
Copy link

Updating minSdkVersion to 26 solved this issue for me for now in android.

Looking for a better solution if available.

@natemartins
Copy link

@mgcrea Updating to v0.5.1 fixed it.

Note that you would have to set minSdkVersion to 26 if you're on a version lower than 26. Thanks to @manish0707 for pointing this out

@sekoyo
Copy link

sekoyo commented Oct 10, 2023

"react-native": "0.72.5",
"react-native-vision-camera": "^3.3.1",
kotlinVersion = "1.7.21"
buildToolsVersion = "33.0.0"
minSdkVersion = 28
compileSdkVersion = 33
targetSdkVersion = 33

Gradle 8.0.1

babelconfig.js (actually think this isn't needed in v3, removing doesn't change error though):

[
  'react-native-reanimated/plugin',
  {
    globals: ['__scanCodes'],
  },
],

For bar codes (not using a package just this lib and works on iOS):

<application ...>
      ...
      <meta-data
          android:name="com.google.mlkit.vision.DEPENDENCIES"
          android:value="barcode" />
</application>

But I still get errors trying to build android (in RN CLI) 🤔

<projectPath>/node_modules/vision-camera-code-scanner/android/src/main/java/com/visioncameracodescanner/VisionCameraCodeScannerPluginPackage.java:19: error: cannot find symbol
    FrameProcessorPlugin.register(new VisionCameraCodeScannerPlugin());
                        ^
  symbol:   method register(VisionCameraCodeScannerPlugin)
  location: class FrameProcessorPlugin
<projectPath>/node_modules/vision-camera-code-scanner/android/src/main/java/com/visioncameracodescanner/VisionCameraCodeScannerPlugin.java:40: error: VisionCameraCodeScannerPlugin is not abstract and does not override abstract method callback(Frame,Map<String,Object>) in FrameProcessorPlugin
public class VisionCameraCodeScannerPlugin extends FrameProcessorPlugin {
       ^
<projectPath>/node_modules/vision-camera-code-scanner/android/src/main/java/com/visioncameracodescanner/VisionCameraCodeScannerPlugin.java:62: error: method does not override or implement a method from a supertype
  @Override
  ^
<projectPath>/node_modules/vision-camera-code-scanner/android/src/main/java/com/visioncameracodescanner/VisionCameraCodeScannerPlugin.java:251: error: constructor FrameProcessorPlugin in class FrameProcessorPlugin cannot be applied to given types;
    super("scanCodes");
    ^
  required: no arguments
  found: String
  reason: actual and formal argument lists differ in length
4 errors

@sekoyo
Copy link

sekoyo commented Oct 10, 2023

Nevermind, somehow vision-camera-code-scanner was still in my yarn.lock, explicitly removing it fixed the error
Screenshot 2023-10-10 at 4 38 43 PM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests