friyiajr/BLESampleExpo

ERROR TypeError: Cannot read property 'createClient' of null

Closed this issue · 7 comments

I'm getting above error when creating new BLE Manager:
const bleManager = (() => new BleManager(), []);

Im getting the same error.

I've seen this in the YouTube comments as well. I've never been able to reproduce this on my end though. To take action on this I would need steps to reproduce this on my end. This doesn't happen to most people so this is a tricky bug to pin down

I'm getting the same error. But I'm getting it while trying to debug on the Expo Go app on my phone. So, if starting the server with command yarn expo run:android this error is not present. However, if starting it with yarn expo start and reading the QR code with the app, the error appears. These are the logs:

$ yarn expo start
yarn run v1.22.19
$ /home/juanmagomez/Git/app/node_modules/.bin/expo start
Starting project at /home/juanmagomez/Git/app
Starting Metro Bundler
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█ ▄▄▄▄▄ █▀█ █▄█▀▀ ▄▀▄▀█ ▄▄▄▄▄ █
█ █   █ █▀▀▀█ ▀▀ █▀▀█▀█ █   █ █
█ █▄▄▄█ █▀ █▀▀▄█▀ █▀▄██ █▄▄▄█ █
█▄▄▄▄▄▄▄█▄▀ ▀▄█ █ █ ▀▄█▄▄▄▄▄▄▄█
█▄ ▄ ▄▀▄  ▄▀▄▀ ▄█▀▄▄ ▄▄▀▄▀▄█▄▀█
█▀▀▀ ▀▀▄ ██▄█▀▄▄ ▀█ ███▀▄ ██▀██
█▀█▄▀▄▄▄█▄▄▄█▄▄▄█▀▄▄ ▄ ▀▄▀▄ █▀█
█▄█▀   ▄ ▄▄▀ ▄▄ ▄ █ ██▀ ▀██▄▀██
█ █████▄ ▀█▀▄▀▀███   ▄▄▀█▀▀ █▀█
█ █▄█ ▀▄ ▀█▄█▀ ▄▄ ▄█▀▀▄██▀▄▄▀██
█▄█▄█▄▄▄█▀▄ █▄█▄█▀▀█▄ ▄▄▄ ▀   █
█ ▄▄▄▄▄ █▄▀▀ ▄█▀ █▄█▄ █▄█ ▄▄▀██
█ █   █ █ ▄ ▄▀▀▀▄ ▄▀▀▄ ▄ ▄▄▄  █
█ █▄▄▄█ █ ▄ █▀ ▄ ███ ▀█▄▀▄▄█ ██
█▄▄▄▄▄▄▄█▄▄██▄█▄█▄▄███▄█▄▄▄▄███

› Choose an app to open your project at http://172.17.145.88:19000/_expo/loading
› Metro waiting on exp://172.17.145.88:19000
› Scan the QR code above with Expo Go (Android) or the Camera app (iOS)

› Press a │ open Android
› Press w │ open web

› Press j │ open debugger
› Press r │ reload app
› Press m │ toggle menu

› Press ? │ show all commands

Logs for your project will appear below. Press Ctrl+C to exit.
Android Bundling complete 1315ms
 ERROR  TypeError: Cannot read property 'createClient' of null

This error is located at:
    in App (created by withDevTools(App))
    in withDevTools(App)
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in main(RootComponent), js engine: hermes
 ERROR  TypeError: Cannot read property 'createClient' of null

This error is located at:
    in App (created by withDevTools(App))
    in withDevTools(App)
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in main(RootComponent), js engine: hermes

I need to run the app on the phone to actually test BT connection with the BLE devices. This is something I cannot, IMO, try from an Android simulator on my PC.

Hi @juanmagramos this example project will not run in Expo GO. Because it uses prebuild it is not compatible. See Managed vs Bare Workflow. What you need to do is plug your phone into your computer and run npx expo run:android --device and choose your physical device from the list of devices.

Thanks a lot @friyiajr! This solved my issue. I've had to activate several settings on the phone, but now I'm able to debug and see a list of BLE devices. Will keep going with your great YouTube tutorial

Thanks @juanmagramos I am going to close this issue because its most likely why most people are experiencing this. Thank you for your detailed report!