voice icon indicating copy to clipboard operation
voice copied to clipboard

Native module cannot be null

Open chukwuezi opened this issue 6 years ago • 11 comments
trafficstars

Bug

The error occurs once importing Voice.

Environment info

React native info output: React Native Environment Info: System: OS: macOS High Sierra 10.13.6 CPU: (8) x64 Intel(R) Core(TM) i7-2635QM CPU @ 2.00GHz Memory: 155.11 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 10.14.2 - ~/.nvm/versions/node/v10.14.2/bin/node npm: 6.4.1 - ~/.nvm/versions/node/v10.14.2/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1 IDEs: Android Studio: 3.2 AI-181.5540.7.32.5056338 Xcode: 10.1/10B61 - /usr/bin/xcodebuild npmPackages: react: 16.8.3 => 16.8.3 react-native: ^0.59.5 => 0.59.5 npmGlobalPackages: react-native-cli: 2.0.1

Library version: 0.3.0

Steps To Reproduce

Either link by using pods, or manually linking as the instruction describes, produces the same error.

Describe what you expected to happen:

  1. No crash/error.

chukwuezi avatar Aug 03 '19 16:08 chukwuezi

I have been having this too. Heres how I solved this one.

  1. react-native init app-name && cd app-name
  2. yarn add react-native-voice
  3. cd ios
  4. pod install
  5. Edit ios/app-name/Info.plist and add the permissions from the readme.
  6. open the workspace in xcode
  7. run from xcode (you may be able to do this with react-native run-ios, I'm not sure)

I still dont have this lib working correctly but at least I'm past this error

lukemcgregor avatar Aug 14 '19 04:08 lukemcgregor

I ran into the same issue. Nothing helps me. Are there any solutions here?

deepslam avatar Aug 22 '19 16:08 deepslam

I ran into the same issue. Nothing helps me. Are there any solutions here?

I decided to point my installation to master: in package.josn "react-native-voice": "github:react-native-community/react-native-voice", Or npm install react-native-voice@'react-native-community/react-native-voice'

Then just follow the manual linking instructions.

chukwuezi avatar Aug 22 '19 19:08 chukwuezi

I ran into the same issue. Nothing helps me. Are there any solutions here?

I decided to point my installation to master: in package.josn "react-native-voice": "github:react-native-community/react-native-voice", Or npm install react-native-voice@'react-native-community/react-native-voice'

Then just follow the manual linking instructions.

Thank you for help! But unfortunately, I'm still faced with this error (

deepslam avatar Aug 22 '19 20:08 deepslam

make sure you do the following 2 things for iOS [https://github.com/react-native-community/react-native-voice#manually-link-ios]

  1. Drag the Voice.xcodeproj from the react-native-voice/ios folder to the Libraries group on Xcode in your poject. Manual linking
  1. Click on your main project file (the one that represents the .xcodeproj) select Build Phases and drag the static library, lib.Voice.a, from the Libraries/Voice.xcodeproj/Products folder to Link Binary With Libraries

I had the problem, and performed the 2 steps fixed the issue. Try clean the project and rebuild again? Good luck

hokaiyipFS avatar Aug 31 '19 19:08 hokaiyipFS

@hokaiyipFS's solution worked, but I also had to run 'react-native unlink react-native-voice'

MicahSteinbrecher avatar Dec 06 '19 19:12 MicahSteinbrecher

@chukwuezi did you solve your problem?

lfoliveir4 avatar Dec 16 '19 11:12 lfoliveir4

Adding the following line to my Podfile was necessary to build: pod 'react-native-voice', :path => '../node_modules/@react-native-community/voice'

pgqueme avatar Mar 18 '20 23:03 pgqueme

in my case, I run react-native link @react-native-community/voice navigate to the ios folder run pod install cleaned the project and rebuilt the error is gone. also in the constructor please make sure that you bind "this" keyword like this Voice.onSpeechStart = this.onSpeechStartHandler.bind(this);

AliAmjadHassan avatar Jul 11 '21 21:07 AliAmjadHassan

Thanks for the bug report, ill checkout why the current NPM package is not working. The community package is deprecated.

safaiyeh avatar Jul 13 '21 16:07 safaiyeh

I installed from NPM and I couldn't find lib.Voice.a, or the Libraries/Voice.xcodeproj/Products folder. But I found the libVoice.a binary by clicking the plus (+) button in "Build Phases > Link Binary with Libraries". Still haven't tested the build yet, just thought to add this info in case anyone else can't find the "Libraries/Voice.xcodeproj/Products" folder. YW :)

MezMerrit avatar Jan 31 '23 10:01 MezMerrit