rusel1989 / react-native-bluetooth-serial

Port of https://github.com/don/BluetoothSerial for react native
475 stars 291 forks source link

React Native (without Expo) installation #136

Closed Jupkobe closed 3 months ago

Jupkobe commented 3 months ago

I had troubles make this library work so here is what I did:

  1. Follow the installing procedures in the readme file. I did both normal and manual way for android but I'm not sure which is worked, so.
  2. Delete the "@ Override" tags inside

node-modules/react-native-bluetooth-serial/android/src/main/java/com/rusel/[YourProject]/RCTBluetoothSerialPackage.java

  1. Change the word from compile to implementation inside dependencies block in

node-modules/react-native-bluetooth-serial/android/build.gradle

  1. in android/build.gradle file, delete the compile... row that it says in the installation. and add this code to the top of buildscript block: subprojects { subproject -> afterEvaluate{ if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) { android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion } } } } This fixed the gradle issue which I faced after I changed compile to implementation.
  2. Delete the new RCTBluetoothSerialPackage() inside getPackages function which is inside

android/app/src/main/java/com/[YourProject]/MainApplication.kt

I have no idea what react-native link was doing but I believe that this has to do something with it and it no longer needed.

And after those steps I managed to get it working.