react-native-bluetooth-serial icon indicating copy to clipboard operation
react-native-bluetooth-serial copied to clipboard

This plugin does not work!!!!

Open ithieund opened this issue 7 years ago • 7 comments

@rusel1989 , Is this project continue maintaining? I tried to install and run but it throw an error:

/Users/hieunguyen/Mobile/ArduinoBT/node_modules/react-native-bluetooth-serial/android/src/main/ja va/com/rusel/RCTBluetoothSerial/RCTBluetoothSerialPackage.java:23: error: method does not overrid e or implement a method from a supertype @Override ^ 1 error :react-native-bluetooth-serial:compileReleaseJavaWithJavac FAILED

I also tried dowloading the example project and run but no luck too. It throw error about 'sane' while running react-native run-android

Can you please fix these issue? Thanks.

ithieund avatar Feb 02 '18 16:02 ithieund

The method that is being overridden has been deprecated and removed since react-native 0.47, if you modify this file (/Users/hieunguyen/Mobile/ArduinoBT/node_modules/react-native-bluetooth-serial/android/src/main/ja va/com/rusel/RCTBluetoothSerial/RCTBluetoothSerialPackage.java) and simply remove the @ Override annotation just before the createJSModules method, that should fix it temporarily.

Your other choice is to use an older version of RN.

darkrift avatar Feb 04 '18 21:02 darkrift

@darkrift , Thank you very much, I tried and it worked, but some others issue occurred :( Do you know about the roadmap for this project? Is it stoped maintaining?

Thanks.

ithieund avatar Feb 05 '18 02:02 ithieund

@ithieund I have no idea of the roadmap of this project. I was trying to find a library doing bluetooth classic and it seems we are pretty limited in terms of plugins for that purpose (found only 1 other than this one). While trying this one, I had that issue and fixed it temporarily so I could actually give it a better try.

darkrift avatar Feb 05 '18 14:02 darkrift

Just testing this library, this error is easy to solve. Just remove @ Override from /node_modules/react-native-bluetooth-serial/android/src/main/java/com/rusel/RCTBluetoothSerial/RCTBluetoothSerialPackage.java

from this

public class RCTBluetoothSerialPackage implements ReactPackage {
    static final String TAG = "BluetoothSerial";

    @Override
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
        List<NativeModule> modules = new ArrayList<>();
        modules.add(new RCTBluetoothSerialModule(reactContext));
        return modules;
    }

    @Override
    public List<Class<? extends JavaScriptModule>> createJSModules() {
        return Collections.emptyList();
    }

    @Override
    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
        return Collections.emptyList();
    }
}

to this

public class RCTBluetoothSerialPackage implements ReactPackage {
   static final String TAG = "BluetoothSerial";

   
   public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
       List<NativeModule> modules = new ArrayList<>();
       modules.add(new RCTBluetoothSerialModule(reactContext));
       return modules;
   }

   
   public List<Class<? extends JavaScriptModule>> createJSModules() {
       return Collections.emptyList();
   }

   
   public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
       return Collections.emptyList();
   }
}

esbozos avatar May 24 '18 03:05 esbozos

@esbozos , Thank you very much. I can make it work already.

It seems that the author of this plugins does not maintain it any more. How about forking this into another repository and imporove it?

Can you do that? Thanks.

ithieund avatar May 24 '18 05:05 ithieund

For anyone using react-native 0.61.5, you need to disable autolinking for this package.

https://github.com/react-native-community/cli/blob/master/docs/autolinking.md

After removing @Override and disabling autolinking, it works!

WhaSukGO avatar Mar 21 '20 15:03 WhaSukGO

@WhaSukGO Thank you man. It worked

whatdtech avatar Nov 24 '20 16:11 whatdtech