pushpender-singh-ap / react-native-scanner

A QR code & Barcode Scanner for React Native Projects. It supports React Native's new Fabric Native architecture and was created in Kotlin and Objective-C.
https://www.npmjs.com/package/@pushpendersingh/react-native-scanner
MIT License
54 stars 10 forks source link

rncore/States.cpp Build input file cannot be found: #11

Closed khanakia closed 9 months ago

khanakia commented 1 year ago

I installed a fresh application and it ran fine after that I followed the instructions to install the scanner app.

Once i installed the package now i could not build anymore

/Users/test/BarcodeScannerTest/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.cpp Build input file cannot be found: 

'/Users/test/BarcodeScannerTest/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.cpp'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it?

I believe it's related to this issue https://stackoverflow.com/questions/76721082/react-native-error-build-input-file-cannot-be-found-node-modules-react-nativ

pushpender-singh-ap commented 1 year ago

Please share the "npx react-native info" command output, package.json and podfile

khanakia commented 1 year ago

I have uploaded a test repo here https://github.com/khanakia/BarcodeScannerTest

➜  BarcodeScannerTest git:(main) npx react-native info
info Fetching system and libraries information...
System:
  OS: macOS 13.5
  CPU: (10) arm64 Apple M1 Max
  Memory: 14.53 GB / 64.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.17.1
    path: ~/.nvm/versions/node/v18.17.1/bin/node
  Yarn:
    version: 1.22.19
    path: /usr/local/bin/yarn
  npm:
    version: 9.6.7
    path: ~/.nvm/versions/node/v18.17.1/bin/npm
  Watchman:
    version: 2023.08.28.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.13.0
    path: /Users/khanakia/.rvm/gems/ruby-2.7.7/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 22.4
      - iOS 16.4
      - macOS 13.3
      - tvOS 16.4
      - watchOS 9.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.2 AI-222.4459.24.2221.10121639
  Xcode:
    version: 14.3.1/14E300c
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 20.0.2
    path: /usr/bin/javac
  Ruby:
    version: 2.7.7
    path: /Users/khanakia/.rvm/rubies/ruby-2.7.7/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.5
    wanted: 0.72.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: true
pushpender-singh-ap commented 1 year ago

Test repo is working fine below is the screenshot (You just missed the installation of react-native-permissions)

Screenshot 2023-09-25 at 10 41 13 PM
khanakia commented 1 year ago

Yes i am able to run now

pushpender-singh-ap commented 1 year ago

@khanakia I think you don't setup the react native permissions that why you facing this issue?

khanakia commented 1 year ago

Yes it's working now but another issue is it's not able to scan all the barcodes As you can see below screenshot i am able to scan EID and MEID but it's not scanning IMEI and IMEI2

IMG_A6647CF986B3-1

pushpender-singh-ap commented 1 year ago

Let me check is this AVFoundation support these type of Barcodes.

pushpender-singh-ap commented 1 year ago

Barcode scanning work properly even with IMEI & 2 (CODE 128 type of barcode)

khanakia commented 1 year ago

Strange. I am testing with iPhone 13 Pro Camera it only scans MEID and EID, not the IMEI

khanakia commented 1 year ago

I have confirmed with different Phone Imei Barcode it just gives this error when i scan via iPhone 13

2023-09-25 23:21:51.859975+0530 BarcodeScannerTest[50051:8125391] SocketStream read error [0x283118000]: 1 54

Just a note Do you provide some kind of Paid support to help us solve the problem if possible ?

Thanks, Pushpender

pushpender-singh-ap commented 1 year ago

@khanakia Thank you for sharing the log. I'll thoroughly investigate and debug the issue. If you happen to discover a solution, please feel free to submit a pull request. While I genuinely appreciate your offer of paid support, it won't be necessary at this time.

khanakia commented 1 year ago

If you happen to be available over call tomorrow if possible i can share you my screen and show you the issue may be that will help also check in another iPhone too

pushpender-singh-ap commented 1 year ago

You can provide me the screen recording.

khanakia commented 1 year ago

I will do. Also, i just tried this app https://github.com/alfianlosari/BarcodeTextScannerSwiftUI and it worked fine It seems they are using Vision Kit not 100% sure

khanakia commented 1 year ago

You can provide me the screen recording.

Here's the video https://i.analyzify.app/QwuBQOZv

you will be able to see it scans the EID and MEDI only

khanakia commented 1 year ago

@pushpender-singh-ap I have checked many other libraries react-native-camera-kit, react-native-camera v2, expo-barcode-scanner etc. All of them also not working also for the IMEI scan but i also used some native apps like above i sent you which are using Apple Vision Kit so they are working.

It has to do with something or some bug within not Avfoundation maybe

pushpender-singh-ap commented 1 year ago

@khanakia I was try to add vision kit but it's failed because in vision kit apple not provide the objective-c documentation for DataScannerViewController.

khanakia commented 1 year ago

Hi DataScannerViewController is only available for Swift we can try to use this https://developer.apple.com/documentation/visionkit/vndocumentcameraviewcontroller or VNDocumentCameraScan

pushpender-singh-ap commented 1 year ago

Hello @khanakia , could you kindly clone this repository: https://github.com/pushpender-singh-ap/react-native-nativeios-scanner and attempt to scan the IMEI barcode? Unfortunately, I don't currently have access to any iPhone devices, so I'm unable to test it myself at the moment. Your assistance would be greatly appreciated!

khanakia commented 1 year ago

Also pod install was giving error so first i did bundle install and then ran RCT_NEW_ARCH_ENABLED=1 bundle exec pod install Getting this error while building

Screenshot 2023-09-26 at 7 36 47 PM

pushpender-singh-ap commented 1 year ago

@khanakia Can you compile for Simulator because i was build on Simulator it's working correctly but not sure about the real-device.

khanakia commented 1 year ago

same error

ld: library not found for -ld_classic
clang: error: linker command failed with exit code 1 (use -v to see invocation)
khanakia commented 1 year ago

It has to do something with this because when i compare this with the New React project there are no flags i could find -Wl -ld_classic Screenshot 2023-09-26 at 7 50 11 PM

pushpender-singh-ap commented 1 year ago

Run this command in you rootProject yarn add ./react-native-nativeios-scanner && cd .. && node react-native-nativeios-scanner/node_modules/react-native/scripts/generate-codegen-artifacts.js \ --path react-native-nativeios-scanner/ \ --outputPath react-native-nativeios-scanner/react-native-nativeios-scanner/generated/

after this cd project and ios run RCT_NEW_ARCH_ENABLED=1 bundle exec pod install

khanakia commented 1 year ago

I am not using the module in my project i simply ran the command inside this repo root https://github.com/pushpender-singh-ap/react-native-nativeios-scanner

Getting error

node:internal/modules/cjs/loader:1080
  throw err;
  ^

Error: Cannot find module '/Users/khanakia/react-native-nativeios-scanner/node_modules/react-native/scripts/generate-codegen-artifacts.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v18.17.1
khanakia commented 1 year ago

I was able to install the app after i removed the below flags

"-Wl",
"-ld_classic",
"-Wl",
"-ld_classic",

But i do not see any camera and also i tried clicking Start Scanning button simulator_screenshot_1F89EE27-A547-464C-9A88-6417FF0EB360

pushpender-singh-ap commented 1 year ago

@khanakia Thanks for the update i will check this why it's happening.

khanakia commented 1 year ago

For now i have created a custom module in OLD Arch https://github.com/khanakia/react-native-barcodeoldarch as i needed this urgently.

Once you are able to complete your module i will replace it with yours.

Thanks @pushpender-singh-ap