MacKentoch / react-native-beacons-manager

React-Native library for detecting beacons (iOS and Android)
MIT License
579 stars 319 forks source link

java.lang.NoSuchMethodError: No interface method putArray #184

Open cristinaITdeveloper opened 4 years ago

cristinaITdeveloper commented 4 years ago

Version

1.0.7

Platform

Android

React Native version

0.61.2

OS version

Android 9.0

Steps to reproduce

  1. Add the library with yarn
  2. Install app on android device

Actual behavior

I have an error in my android app

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.eva, PID: 23250
    java.lang.NoSuchMethodError: No interface method putArray(Ljava/lang/String;Lcom/facebook/react/bridge/WritableArray;)V in class Lcom/facebook/react/bridge/WritableMap; or its super classes (declaration of 'com.facebook.react.bridge.WritableMap' appears in /data/app/com.eva-ZxmhKbqThU4zJI5uQS9CcQ==/base.apk)
        at com.mackentoch.beaconsandroid.BeaconsAndroidModule.createRangingResponse(BeaconsAndroidModule.java:254)
        at com.mackentoch.beaconsandroid.BeaconsAndroidModule.access$300(BeaconsAndroidModule.java:35)
        at com.mackentoch.beaconsandroid.BeaconsAndroidModule$2.didRangeBeaconsInRegion(BeaconsAndroidModule.java:235)
        at org.altbeacon.beacon.IntentHandler.convertIntentsToCallbacks(IntentHandler.java:49)
        at org.altbeacon.beacon.BeaconLocalBroadcastProcessor$1.onReceive(BeaconLocalBroadcastProcessor.java:87)
        at androidx.localbroadcastmanager.content.LocalBroadcastManager.executePendingBroadcasts(LocalBroadcastManager.java:313)
        at androidx.localbroadcastmanager.content.LocalBroadcastManager$1.handleMessage(LocalBroadcastManager.java:121)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6694)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Vidzhel commented 4 years ago

React Native: 61.5

OS version

Android 9.0

I encountered exactly the same problem when imported the "1.1.0" version of the library and added

implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'

and I also tried

implementation 'com.android.support:localbroadcastmanager:28.0.0'

to the gradle.build dependencies at android\app\build.gradle as noted here. Without localbroadcastmanager I keep on getting another error:

Screenshot_2020-05-02-05-45-46-819_com freeline

I read a whole lot of posts on the problem, but still, I haven't figured out how to solve it. The only information I've got is that the issue is connected with react-native implementation of WritableArray (obviously) in a few of the last versions of React Native. Although, I haven't tried to switch to an older version of RN, I'm sure it will work (here's an application that's working on RN 55 and uses beacons manager library and it seems to be working).

Edit:

I downgraded to the version 60.6 of RN and all work like a charm.

nemr-maher commented 3 years ago

React Native: 0.63

OS version

Android 10.0

I installed and linked the library and got the exact same error that Vidzhel got without doing anything to the build file, is there any solution other than downgrading the RN version?

image

kirantripathi commented 3 years ago

@nemr-maher I am also facing the same issue.Did you check it in ios , wii there be issue in ios too.

feerposser commented 3 years ago

Same issue here. Someone solve it using RN > 0.60 ?

kirantripathi commented 3 years ago

@feerposser can you try with this version , and let me know whether it works or not. git://github.com/MacKentoch/react-native-beacons-manager.git#53c1bda It work for me in android, I haven't tested this in IOS till now.

BrianCodeItUp commented 3 years ago
  1. "java.lang.NoSuchMethodError: No interface method putArray" A: the react native version of 1.0.7 is way too old, you can check the build.gradle in node_modules of this package. To solved this issue, you can just use the newest version on the master branch "react-native-beacons-manager": "git://github.com/MacKentoch/react-native-beacons-manager.git#d118c87"
  2. "Could not invoke BeaconAndroidModule.startRanging" A: this got solved when i add localbroadcastmanager dependency in its build.grable

image

BrianCodeItUp commented 3 years ago

@kirantripathi yes, i can be able to detect nearby iBeacon singnal image

kirantripathi commented 3 years ago

@BrianCodeItUp @MacKentoch I try to scan beacon in IOS but it is not returning me search beacon response. IT works correctly in android , but didn't work in IOS. these are the basic setup that I have use . I don't know if it's setup issue. I get response in both "startMonitoringForRegion" and "startRangingBeaconsInRegion" but i don't get any response in "beaconsDidRange" listener. Any idea on how can I solve this ?

Screen Shot 2020-12-22 at 18 05 04 Screen Shot 2020-12-22 at 18 05 35
BrianCodeItUp commented 3 years ago

@kirantripathi Here is my info.plist. You need