Installation - WiMetrixDev/rn-usb-serial GitHub Wiki
You should run
npm add rn-usb-serial
or
yarn add rn-usb-serial
or
pnpm add rn-usb-serial
Expo
If you are using Expo then installation is complete and you don't need to make any further changes
Bare React Native
Automatic Installation
react-native link react-native-serialport
Manual Installation
android/app/src/main/java/[...]/MainActivity.java
1. Open up - Add
import com.reactlibrary.RNSerialportPackage;
to the imports at the top of the file - Add
new RNSerialportPackage()
to the list returned by thegetPackages()
method
android/settings.gradle
:
2. Append the following lines to include ':react-native-serialport'
project(':react-native-serialport').projectDir = new File(rootProject.projectDir,
'../node_modules/react-native-serialport/android')
android/app/build.gradle
:
3. Insert the following lines inside the dependencies block in implementation project(':react-native-serialport')