react-native-beacons-manager
react-native-beacons-manager copied to clipboard
java.lang.NoSuchMethodError: No interface method putArray
Version
1.0.7
Platform
Android
React Native version
0.61.2
OS version
Android 9.0
Steps to reproduce
- Add the library with yarn
- 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)
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:
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.
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?
@nemr-maher I am also facing the same issue.Did you check it in ios , wii there be issue in ios too.
Same issue here. Someone solve it using RN > 0.60 ?
@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.
-
"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"
-
"Could not invoke BeaconAndroidModule.startRanging"
A: this got solved when i add
localbroadcastmanager
dependency in itsbuild.grable
@kirantripathi yes, i can be able to detect nearby iBeacon singnal
@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 ?
@kirantripathi
Here is my info.plist
.
You need
-
NSLocationAlwaysUsageDescription : for monitoring
-
NSLocationWhenInUseUsageDescription: for ranging
-
Ranging trigger event: beaconsDidRange
-
Monitoring trigger event: regionDidEnter, regionDidExit I haven't actuaully test monitoring yet. But ranging works just fine for me.