其实造成闪退的原因是
import Beacons from 'react-native-beacons-manager';
Beacons.startRangingBeaconsInRegion('参数') //这个方法造成闪退
解决办法
找到node_modules\react-native-beacons-manager\android\build.gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.facebook.react:react-native:0.61.+' //修改这一行
compile 'org.altbeacon:android-beacon-library:2.9.2'
}
修改上面注释的地方改为适应自己RN版本及以上
比如我得react-native版本是0.61,那我就改成0.61+
笔者博客主页有完整demo以及react-native-beacons-manager踩坑经验