react-native-beacons-manager icon indicating copy to clipboard operation
react-native-beacons-manager copied to clipboard

java.lang.NoSuchMethodError: No interface method putArray

Open cristinaITdeveloper opened this issue 4 years ago • 9 comments

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)

cristinaITdeveloper avatar Apr 20 '20 10:04 cristinaITdeveloper

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.

Vidzhel avatar May 02 '20 03:05 Vidzhel

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

nemr-maher avatar Oct 27 '20 13:10 nemr-maher

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

kirantripathi avatar Nov 07 '20 09:11 kirantripathi

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

feerposser avatar Nov 21 '20 18:11 feerposser

@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.

kirantripathi avatar Nov 23 '20 05:11 kirantripathi

  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 avatar Dec 01 '20 08:12 BrianCodeItUp

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

BrianCodeItUp avatar Dec 02 '20 08:12 BrianCodeItUp

@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

kirantripathi avatar Dec 22 '20 12:12 kirantripathi

@kirantripathi Here is my info.plist. You need

  • NSLocationAlwaysUsageDescription : for monitoring

  • NSLocationWhenInUseUsageDescription: for ranging image

  • Ranging trigger event: beaconsDidRange

  • Monitoring trigger event: regionDidEnter, regionDidExit I haven't actuaully test monitoring yet. But ranging works just fine for me. image

BrianCodeItUp avatar Dec 24 '20 03:12 BrianCodeItUp