React-native-ble-plx: RN 60.4 Build Error

Created on 9 Aug 2019  路  7Comments  路  Source: Polidea/react-native-ble-plx

Is this library compatible with latest RN version (60.4)?
I keep getting a react native native module cannot be null error when I try to setup this package in my project.

I was able to fix this by downgrading RN version to 59.3, but I just want to be sure If it's just not compatible with 60.4 yet, or I'm missing something.

question stale

Most helpful comment

It's mentioned in README file:

  1. If you are using AndroidX, then for the time being you need to convert import statements in the Android library with jetifier. These steps apply for all react-native packages, which are during the transition period:
  • npm install --save-dev jetifier
  • Run jetify script after npm install. You can do it by adding "postinstall" script to the package.json file:
    json ... "postinstall": "npx jetify", ...

Did you try that?

All 7 comments

I get the same errors with react-native 0.60.5.

> Task :react-native-ble-plx:compileReleaseJavaWithJavac FAILED
/Users/vsts/agent/2.155.1/work/1/s/node_modules/react-native-ble-plx/android/src/main/java/com/polidea/reactnativeble/converter/RxBleScanResultConverter.java:3: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
                                 ^
/Users/vsts/agent/2.155.1/work/1/s/node_modules/react-native-ble-plx/android/src/main/java/com/polidea/reactnativeble/wrapper/Characteristic.java:5: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
                                 ^
/Users/vsts/agent/2.155.1/work/1/s/node_modules/react-native-ble-plx/android/src/main/java/com/polidea/reactnativeble/wrapper/Service.java:5: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
                                 ^
...

How can this be solved?

I get the same errors with react-native 0.60.5.

> Task :react-native-ble-plx:compileReleaseJavaWithJavac FAILED
/Users/vsts/agent/2.155.1/work/1/s/node_modules/react-native-ble-plx/android/src/main/java/com/polidea/reactnativeble/converter/RxBleScanResultConverter.java:3: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
                                 ^
/Users/vsts/agent/2.155.1/work/1/s/node_modules/react-native-ble-plx/android/src/main/java/com/polidea/reactnativeble/wrapper/Characteristic.java:5: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
                                 ^
/Users/vsts/agent/2.155.1/work/1/s/node_modules/react-native-ble-plx/android/src/main/java/com/polidea/reactnativeble/wrapper/Service.java:5: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
                                 ^
...

How can this be solved?

I wasn't able to resolve it on React Native versions above 0.59.3, I think thats the latest version that this library supports.

It's mentioned in README file:

  1. If you are using AndroidX, then for the time being you need to convert import statements in the Android library with jetifier. These steps apply for all react-native packages, which are during the transition period:
  • npm install --save-dev jetifier
  • Run jetify script after npm install. You can do it by adding "postinstall" script to the package.json file:
    json ... "postinstall": "npx jetify", ...

Did you try that?

If you're using yarn workspaces, you may need to add the library in the nohoist section of the projects package.json.:

"workspaces": {
        "nohoist": [
...
            "react-native-ble-plx",
            "react-native-ble-plx/**",
...
        ]
    }

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Any solution for that? I have the same issue.

As same for me with this commands :

react-native link react-native-ble-plx 
npm run postinstall; npm run android
Was this page helpful?
0 / 5 - 0 ratings

Related issues

SlavaInstinctools picture SlavaInstinctools  路  4Comments

alfacommunication-alessandro picture alfacommunication-alessandro  路  4Comments

haohcraft picture haohcraft  路  5Comments

juanjo-ramos picture juanjo-ramos  路  3Comments

KarthickCSK picture KarthickCSK  路  3Comments