This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF Connect (3.1.0 - Windows 10) Error while launching app : Cannot read property 'selectedAdapter' of undefined.

I am new to this environment.

Attempting to create a simple BLE app similar to the built-in BLE, but with some buttons to send predetermined commands to devices.  Using the boiler app, I have been pulling code from the BLE github code and I am close to being done but now I get this error (in title) immediately after launching from nRF Connect.  When running "npm install", "npm run build", and "npm test" there are no errors or warnings.

Searching through the .js and .jsx files, I cannot find where this value is instantiated.  The error comes from index.jsx line 304: "state.app.adapter.selectedAdapter" in the mapDeviceSelectorState(state, props) function.

I have attached a zip of the code.

Thank youpc-nrfconnect-boilerplate-v1.zip

  • Hi ,

    Looking into the package you've shared here, I see that you copied contents of BLE and RSSI app on top of the boilerplate repo. This causes a bit of a complication.

    The entrypoint to the app is index.jsx and it must correctly expose several different functions to nRFConnect core in order to work. Please refer to app programming guide here: https://github.com/NordicSemiconductor/pc-nrfconnect-core/wiki, it's important to be familiar with the react-redux framework.

    The error you encounter comes from the fact that the app's state (which is defined by the reducer, or combined reducers) is empty, this is the reduceApp function in index.jsx. It is empty in the boilerplate, since that skeleton app does not need any app state, but in RSSI and in BLE the app state defines the UI.

    I suggest to learn this step by step, first examine the boilerplate and understand each exposed function. The RSSI would be the next step, since it's not complex, and BLE is last and has a very complex state.

    Also to make it easier to understand how the actions interact with the states I suggest to clone pc-nrfconnect-core and build a development version. This gives you a more poweful access to the app's internals.

    Good luck!

Related