GithubHelp home page GithubHelp logo

lovebing / react-native-baidu-map Goto Github PK

View Code? Open in Web Editor NEW
828.0 21.0 321.0 70.01 MB

Baidu Map SDK modules and views for React Native(Android & iOS), support react native 0.61+. 百度地图 React Native 模块,支持 react native 0.61+,已更新到最新的百度地图SDK版本。

License: MIT License

Java 70.93% JavaScript 4.94% Objective-C 23.38% Ruby 0.70% HTML 0.05%

react-native-baidu-map's Introduction

react-native-baidu-map npm version

1.0.x 分支:react-native-baidu-map-old npm version

分支说明:

  • master:支持 react-native 0.61 及以上版本,Android 使用 androidx
  • 1.0.x:支持 react-native 0.60 及 0.50,Android 未使用 androidx

Baidu Map SDK modules and views for React Native(Android & iOS), support react native 0.61.2+

百度地图 React Native 模块。

使用示例:https://github.com/lovebing/react-native-baidu-map-examples

使用百度地图SDK最新版本。 Android 版导入的 SDK 包含以下模块:

  • 基础定位
  • 基础地图(含室内图)
  • 检索功能、LBS云检索
  • 计算工具

在线交流

QQ群:561086908

近期 TODO:

Android

  • 完善坐标转换
  • 添加一些常用的方法

iOS

  • 完善坐标标转换
  • 完善 Cluster(点聚合)
  • 添加一些常用的方法

Marker icon 的实现参考了 https://github.com/react-native-community/react-native-maps 的相关代码。

Android iOS

Dev & Test 开发和测试说明

react-native doesn't support symlinks. see https://stackoverflow.com/questions/44061155/react-native-npm-link-local-dependency-unable-to-resolve-module. Can't install local package by using npm link.

react-native 不支持软链,参考: https://stackoverflow.com/questions/44061155/react-native-npm-link-local-dependency-unable-to-resolve-module 所以不能使用 npm link 的方式安装本地的包

Environments 环境要求

1.JS

  • node: 12+
  • react-native: 0.50.+ 2.Android
  • Android SDK: api 28+
  • gradle: 4.10.1
  • Android Studio: 3.1.3+

3.iOS

  • XCode: 11.3+

初始化

Android

AndroidManifest.xml 设置

必要的权限

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

application 下添加名为 com.baidu.lbsapi.API_KEY 的 meta,如

<meta-data
        android:name="com.baidu.lbsapi.API_KEY"
        android:value="uDRdqQMGQeoPGn5CwMmIYicdUIVv1YST" />

iOS

使用 BaiduMapManager.initSDK 方法设置 api key,如

import { BaiduMapManager } from 'react-native-baidu-map'
BaiduMapManager.initSDK('sIMQlfmOXhQmPLF1QMh4aBp8zZO9Lb2A');

Usage 使用方法

import { MapView, MapTypes, Geolocation, Overlay, MapApp } from 'react-native-baidu-map'

MapView Props 属性

Prop Type Default Description
zoomControlsVisible bool true Android only
trafficEnabled bool false
baiduHeatMapEnabled bool false
zoomGesturesEnabled bool true 允许手势缩放
scrollGesturesEnabled bool true 允许拖动
mapType number 1
zoom number 10
showsUserLocation bool false 是否显示定位
locationData object null 定位信息 {latitude: 0, longitude: 0}
center object null {latitude: 0, longitude: 0}
onMapStatusChangeStart func undefined Android only
onMapStatusChange func undefined
onMapStatusChangeFinish func undefined Android only
onMapLoaded func undefined
onMapClick func undefined
onMapDoubleClick func undefined
onMarkerClick func undefined
onMapPoiClick func undefined

Overlay 覆盖物

const { Marker, Cluster, Arc, Circle, Polyline, Polygon, InfoWindow, HeatMap } = Overlay;
颜色取值说明

6 位(RRGGBB)或 8 位(AARRGGBB)

Marker Props 属性
Prop Type Default Description
title string null 如果没有 InfoWindow,将会根据 title 生成 InfoWindow
titleOffsetY int -80 title 作为 InfoWindow 展示的 y 轴偏移量,仅 Android
location object {latitude: 0, longitude: 0}
perspective bool null 仅 Android
flat bool null 仅 Android
rotate float 0 旋转角度,仅 Android
icon any null icon图片,同 的 source 属性
alpha float 1 透明度,仅 Android
animateType string 动画效果:drop/grow/jump (iOS 仅支持 drop)
pinColor string red red/green/purple,大头针颜色,仅 iOS
onClick func 点击事件回调
Cluster 点聚合
Arc Props 属性
Prop Type Default Description
stroke width {width: 5, color: 'AA000000'}
points array [{latitude: 0, longitude: 0}, {latitude: 0, longitude: 0}, {latitude: 0, longitude: 0}] 数值长度必须为 3
dash bool false 是否为虚线,仅 iOS
Circle Props 属性
Prop Type Default Description
radius int 1400
fillColor string 000000FF
stroke object {width: 5, color: 'AA000000'}
center object {latitude: 0, longitude: 0}
Polyline Props 属性
Prop Type Default Description
points array [{latitude: 0, longitude: 0}]
stroke object {width: 5, color: 'AA000000'}
Polygon Props 属性
Prop Type Default Description
points array [{latitude: 0, longitude: 0}]
fillColor string AAFFFF00
stroke object {width: 5, color: 'AA00FF00'}
Text Props 属性
Prop Type Default Description
text string
fontSize int
fontColor string
bgColor string
rotate float
location object {latitude: 0, longitude: 0}
MarkerIcon 使用 View 作为 marker 的 icon
InfoWindow Props 属性

必须作为 Marker 的子组件

Prop Type Default Description
offsetY int 0 相对于 point 在 y 轴的偏移量,仅 Android

HeatMap Props 属性

Prop Type Default Description
points array
gradient object { colors: ['66FF00', 'FF0000'], startPoints: [0.2, 1.0] } 颜色渐变对象
<MapView>
    <Marker/>
    <Marker>
        <InfoWindow style={{ backgroundColor: 'red', width: 200, height: 100}}>
            <View />
        </InfoWindow>
        <MarkerIcon style={{ backgroundColor: 'red', width: 40, height: 40}}>
            <View>
                <Text>ABC</Text>
            </View>
        </MarkerIcon>
    </Marker>
    <Cluster>
        <Marker/>
    </Cluster>
    <Arc />
    <Circle />
    <Polyline />
    <Polygon />
    <Overlay.Text>text</Overlay.Text>
    <HeatMap />
</MapView>

Marker 示例

<MapView>
    <Overlay.Marker rotate={45} icon={{ uri: 'https://mapopen-website-wiki.cdn.bcebos.com/homePage/images/logox1.png' }} location={{ longitude: 113.975453, latitude: 22.510045 }} />
    <Overlay.Marker location={{ longitude: 113.969453, latitude: 22.530045 }} />
</MapView>

Cluster 示例

<MapView>
    <Cluster>
        <Marker location={{ longitude: 113.969453, latitude: 22.530045 }} />
        <Marker location={{ longitude: 113.968453, latitude: 22.531045 }} />
        <Marker location={{ longitude: 113.967453, latitude: 22.532045 }} />
        <Marker location={{ longitude: 113.966453, latitude: 22.533045 }} />
        <Marker location={{ longitude: 113.965453, latitude: 22.534045 }} />
        <Marker location={{ longitude: 113.965453, latitude: 22.535045 }} />
    </Cluster>
</MapView>

BaiduMapManager

Method Description Result
void initSDK(string apiKey) iOS 初始化 SDK
Promise hasLocationPermission 是否有定位权限

Geolocation Methods

Method Description Result
Promise reverseGeoCode(double lat, double lng) {"address": "", "province": "", "cityCode": "", "city": "", "district": "", "streetName": "", "streetNumber": ""}
Promise reverseGeoCodeGPS(double lat, double lng) {"address": "", "province": "", "cityCode": "", "city": "", "district": "", "streetName": "", "streetNumber": ""}
Promise geocode(String city, String addr) {"latitude": 0.0, "longitude": 0.0}
Promise getCurrentPosition(String coorType) coorType 可为 bd09llgcj02,默认 bd09ll {"latitude": 0.0, "longitude": 0.0, "address": "", "province": "", "cityCode": "", "city": "", "district": "", "streetName": "", "streetNumber": ""} Android: {"latitude": 0.0, "longitude": 0.0, "direction": -1, "altitude": 0.0, "radius": 0.0, "address": "", "countryCode": "", "country": "", "province": "", "cityCode": "", "city": "", "district": "", "street": "", "streetNumber": "", "buildingId": "", "buildingName": ""}
startLocating(function listener, String coorType) 开始持续定位
stopLocating 停止持续定位

GetDistance Methods

Method Result
Promise getLocationDistance({latitude: 0.0, longitude: 0.0}, {latitude: 0.0, longitude: 0.0}) {"distance": 0.0}

MapApp Methods 调起百度地图客户端

Method Description
openDrivingRoute({latitude: 0.0, longitude: 0.0, name: ''}, {latitude: 0.0, longitude: 0.0}, name: '') 调起百度地图驾车规划
openTransitRoute({latitude: 0.0, longitude: 0.0, name: ''}, {latitude: 0.0, longitude: 0.0}, name: '') 调起百度地图公交路线
openWalkNavi({latitude: 0.0, longitude: 0.0, name: ''}, {latitude: 0.0, longitude: 0.0}, name: '') 调起百度地图步行路线
iOS

必须在 Info.plist 中进行如下配置,否则不能调起百度地图客户端

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>baidumap</string>
</array>

鸣谢

jetbrains

react-native-baidu-map's People

Contributors

42997455 avatar bahaa96 avatar chenjim avatar futurechallenger avatar guohuihot avatar kerlw avatar liuximing2016 avatar lmeng987 avatar lovebing avatar minwangwtfssd avatar mmabraham avatar onepiece-dz avatar onlyling avatar pj0579 avatar polyrabbit avatar spelcaster avatar supermaverickws avatar wnger avatar xiapeixu avatar yhaiquan avatar zfn2010 avatar zhangjunhou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-baidu-map's Issues

android版本定位有时会失效

运行demo后发现,刚开始点击定位按钮是可以定到设备坐标的,但是再次移动之后点击定位按钮就没有效果了。

设置一样的markers出错

当多次从A页面进入地图时,给地图设置相同的markers,只有第一次显示所有的markers,后面进入地图只显示最后一个marker

急需帮助,下载了一直不能用

E:\RNWorkSpace\react-native-baidu-map-master>npm install react-native-ba
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\huangwei
act-native-baidu-map"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! code ENOSELF

npm ERR! Refusing to install react-native-baidu-map as a dependency of i
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:
npm ERR! E:\RNWorkSpace\react-native-baidu-map-master\npm-debug.log

找不到BaiduMapPackage

在添加new BaiduMapPackage(getApplicationContext()) 这行代码时,发现比demo缺了这行代码import org.lovebing.reactnative.baidumap.BaiduMapPackage; 我将这行代码手动加上之后,发现无法引用这个文件,导致new BaiduMapPackage(getApplicationContext()) 整行代码也在AS中报错,请问这是有谁知道怎么修改吗?

运行作者的demo,直接报错:unfortunaltely rn have stop !

image
日志如下错误:
01-23 22:13:59.423 2094 2135 I ReactNativeJS: Running application "rn" with appParams: {"initialProps":{},"rootTag":1}. DEV === true, development-level warning are ON, performance optimizations are OFF
01-23 22:13:59.456 2094 2136 I LibraryLoader: Time to load native libraries: 121 ms (timestamps 7611-7732)
01-23 22:13:59.461 2094 2136 I LibraryLoader: Expected native library version number "",actual native library version number ""
01-23 22:13:59.523 2094 2136 W art : Attempt to remove non-JNI local reference, dumping thread
01-23 22:13:59.773 2094 2136 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextShadowNode 01-23 22:14:00.225 2094 2155 D : HostConnection::get() New Host Connection established 0xdd76eb30, tid 2155
01-23 22:14:00.293 2094 2155 E AndroidRuntime: FATAL EXCEPTION: GLThread 165
01-23 22:14:00.293 2094 2155 E AndroidRuntime: Process: com.rn, PID: 2094
01-23 22:14:00.293 2094 2155 E AndroidRuntime: java.lang.IllegalArgumentException: No config chosen
01-23 22:14:00.293 2094 2155 E AndroidRuntime: at android.opengl.GLSurfaceView$BaseConfigChooser.chooseConfig(GLSurfaceView.java:870)
01-23 22:14:00.293 2094 2155 E AndroidRuntime: at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:1024)
01-23 22:14:00.293 2094 2155 E AndroidRuntime: at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1401)
01-23 22:14:00.293 2094 2155 E AndroidRuntime: at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
01-23 22:14:00.351 1012 1024 W ActivityManager: Force finishing activity com.rn/.MainActivity
01-23 22:14:00.386 992 1011 D PermissionCache: checking android.permission.READ_FRAME_BUFFER for uid=1000 => granted (6009 us)
01-23 22:14:00.450 1012 1024 D : HostConnection::get() New Host Connection established 0xdbabde30, tid 1024
01-23 22:14:00.517 992 992 E EGL_emulation: tid 992: eglCreateSyncKHR(1215): error 0x3004 (EGL_BAD_ATTRIBUTE)
01-23 22:14:00.778 1012 1553 W art : Long monitor contention event with owner method=android.graphics.Bitmap com.android.server.wm.WindowManagerService.screenshotApplicationsInner(android.os.IBinder, int, int, int, boolean) from WindowManagerService.java:6223 waiters=0 for 333ms
01-23 22:14:00.800 1012 1143 W art : Long monitor contention event with owner method=void com.android.server.am.ActivityManagerService.crashApplication(com.android.server.am.ProcessRecord, android.app.ApplicationErrorReport$CrashInfo) from ActivityManagerService.java:12502 waiters=1 for 423ms
01-23 22:14:00.928 1012 1022 I art : Background partial concurrent mark sweep GC freed 18553(1415KB) AllocSpace objects, 7(140KB) LOS objects, 33% free, 6MB/9MB, paused 20.360ms total 150.467ms
01-23 22:14:00.989 1012 2164 D OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
01-23 22:14:01.046 1012 1026 I ActivityManager: Killing 1752:com.android.dialer/u0a5 (adj 15): empty #17
01-23 22:14:01.097 1012 2164 I OpenGLRenderer: Initialized EGL, version 1.4
01-23 22:14:01.098 1012 2164 D : HostConnection::get() New Host Connection established 0xdbabd820, tid 2164
01-23 22:14:01.261 1358 1570 W EGL_emulation: eglSurfaceAttrib not implemented
01-23 22:14:01.261 1358 1570 W OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xec9672e0, error=EGL_SUCCESS
01-23 22:14:01.269 2094 2124 E Surface : getSlotFromBufferLocked: unknown buffer: 0xf2cb9d90
01-23 22:14:01.509 1012 2164 W EGL_emulation: eglSurfaceAttrib not implemented
01-23 22:14:01.510 1012 2164 W OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xdb0a48e0, error=EGL_SUCCESS
====================================
我的环境是,genymotion 2.8.1, android 6.0的。有谁可以帮忙看看是什么原因么。

reverseGeoCode

Geolocation.reverseGeoCode(116.413369,39.910976);

返回地址为空。
Object {address: ""}

这个好像是有问题的。

unexpected file type 'wrapper.plug-in' in Frameworks & Libraries build phase

warning: skipping file '/Users/vittorio/Desktop/kaifa/rn/rn_demo/react-native-jifenmao/node_modules/react-native-baidu-map/ios/lib/BaiduMapAPI_Map.framework/Resources/mapapi.bundle' (unexpected file type 'wrapper.plug-in' in Frameworks & Libraries build phase)
跳过了这个文件,然后出现了11个错误
Undefined symbols for architecture x86_64:
"_BMKConvertBaiduCoorFrom", referenced from:
-[BaiduMapModule getBaiduCoor:lng:] in libRCTBaiduMap.a(BaiduMapModule.o)
"_BMKCoorDictionaryDecode", referenced from:
-[BaiduMapModule getBaiduCoor:lng:] in libRCTBaiduMap.a(BaiduMapModule.o)
"OBJC_CLASS$_BMKGeoCodeSearch", referenced from:
objc-class-ref in libRCTBaiduMap.a(BaiduMapModule.o)
"OBJC_CLASS$_BMKGeoCodeSearchOption", referenced from:
objc-class-ref in libRCTBaiduMap.a(BaiduMapModule.o)
"OBJC_CLASS$_BMKMapManager", referenced from:
objc-class-ref in libRCTBaiduMap.a(RCTBaiduMapViewManager.o)
"OBJC_CLASS$_BMKMapView", referenced from:
OBJC_CLASS$_RCTBaiduMapView in libRCTBaiduMap.a(RCTBaiduMapView.o)
"OBJC_CLASS$_BMKPinAnnotationView", referenced from:
objc-class-ref in libRCTBaiduMap.a(RCTBaiduMapViewManager.o)
"OBJC_CLASS$_BMKPointAnnotation", referenced from:
objc-class-ref in libRCTBaiduMap.a(BaiduMapModule.o)
objc-class-ref in libRCTBaiduMap.a(RCTBaiduMapView.o)
objc-class-ref in libRCTBaiduMap.a(RCTBaiduMapViewManager.o)
"OBJC_CLASS$_BMKReverseGeoCodeOption", referenced from:
objc-class-ref in libRCTBaiduMap.a(BaiduMapModule.o)
"OBJC_METACLASS$_BMKMapView", referenced from:
OBJC_METACLASS$_RCTBaiduMapView in libRCTBaiduMap.a(RCTBaiduMapView.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

ios 定位当前位置GPS转换百度位置并没有作用

  • rn : 0.41.2
  • rn-baidu-map : 0.5.0
  • 模拟器运行

应该是下面这段代码转换坐标的吧,搜了下网上的写法,好像一样的,但不知道这个为什么转换不了

-(CLLocationCoordinate2D)getBaiduCoor:(double)lat lng:(double)lng {
    CLLocationCoordinate2D coor = CLLocationCoordinate2DMake(lat, lng);
    NSDictionary* testdic = BMKConvertBaiduCoorFrom(coor,BMK_COORDTYPE_COMMON);
    testdic = BMKConvertBaiduCoorFrom(coor,BMK_COORDTYPE_GPS);
    CLLocationCoordinate2D baiduCoor = BMKCoorDictionaryDecode(testdic);
    
    return baiduCoor;
}

1

build说文件清单的Manifest错误

  • What went wrong:
    Execution failed for task ':app:processDebugManifest'.

    Manifest merger failed with multiple errors, see logs

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

定位偏移很多

这个定位偏移很多,是什么原因呢?存在火星坐标问题吗??

marker出现多个和重叠

这个是什么原因导致的?我看来一下IOS代码,貌似每次设置marker都会去remove annatation?没办法直接更新marker的坐标么

作者你好,我在真机debug环境下定位正常,打正式包后,只显示网络

// 构造
constructor(props) {
super(props);
// 初始状态
this.state = {
mayType:MapTypes.NORMAL,
zoom: 15,
center: {
longitude: 113.981718,
latitude: 22.542449
},
markers: [{
longitude: 113.981718,
latitude: 22.542449,
title: "Window of the world"
},{
longitude: 113.995516,
latitude: 22.537642,
title: ""
}]
};

      Geolocation.getCurrentPosition()
          .then(data => {
              console.log('------------mapdata-------------------');
              console.log(data);
              Geolocation.reverseGeoCode(data.latitude,data.longitude)
                  .then(dataAddress=>{
                      console.log('------------reverseGeoCode-------------------');
                      console.log(dataAddress);
                      this.setState({
                          address: dataAddress.address,
                      });
                  }) .catch(e =>{
                  console.warn(e, 'error');
              });
              this.setState({
                  zoom: 18,
                  marker: {
                      latitude: data.latitude,
                      longitude: data.longitude,
                      title: "当前位置"
                  },
                  center: {
                      latitude: data.latitude,
                      longitude: data.longitude,
                      title:""
                  }
              });
          })
          .catch(e =>{
              console.warn(e, 'error');
          });


  }

<MapView
zoomControlsVisible={false}
zoom={this.state.zoom}
mapType={this.state.mapType}
center={this.state.center}
marker={this.state.marker}
markers={this.state.markers}
style={styles.map}
onMapClick={(e) => {
}}
>

运行Android端 报错

cation.java:29: 错误: 找不到符号
new MainReactPackage(), new BaiduMapPackage(getApplicationContext())
^
符号: 类 BaiduMapPackage
1 个错误
:app:compileDebugJavaWithJavac FAILED

地图显示空白,

在AppDelegate.m中增加了initSDK传入AK,对照了几遍感觉是对的,IOS加载进来地图时空白的,Geolocation获取的到值,请问还有什么可能性,导致地图的map没渲染出来?

你好,请问定位蓝点和导航功能可以实现吗?

1.你好,请问百度地图定位蓝点和导航功能可以实现吗?
2.而且点击locate按钮定位在非洲海边,我改了虚拟机的坐标还是在非洲海边,这是怎么回事?(换成真机就好了)
3.有接口可以获得定位的地址信息吗?(城市和具体地址)
4.地图上的marker的pop重复出现怎么解决?(Android虚拟机和真机上有)
qq20161028-0 2x
4.地图上的marker的pop有办法可以响应点击吗?

markers 删除

markers功能加的快,测试了一下,完全满足我的应用要求,删除的代码稍微有点问题:
if(options.size() < mMarkers.size()) {
int start = options.size();
for (int i = start; i < mMarkers.size(); i++) {
mMarkers.get(i).remove();
mMarkers.remove(i);
}
}
我改成了:
if(options.size() < mMarkers.size()) {
int end = options.size();
int markerSize=mMarkers.size();
for (int i = markerSize; i > options.size(); i--) {
mMarkers.get(i-1).remove();
mMarkers.remove(i-1);
}
}
另外,为什么点击marker,在我手机上会出现两个信息框?

符号找不到

/MainApplication.java:29: 错误: 找不到符号
new BaiduMapPackage(getApplicationContext())
^
符号: 类 BaiduMapPackage
1 个错误
:app:compileDebugJavaWithJavac FAILED

后台运行问题

您好,我现在在做定位后台上传数据,看了好多资料说加Background Modes和NSLocationAlawaysUsageDescription会起作用,但是这个demo我加了,一切换到后台就停止工作了不再上传数据,什么原因呢?可以加个QQ交流一下吗?我的32003737

Android cannot add component to MapView

Android cannot add component to MapView
在Androidsh上无法添加新的View作为子界面

org.lovebing.reactnative.baidumap.BaiduMapViewManager cannot be cast to com.facebook.react.uimanager.ViewGroupManager

{ MapModule.setMapType(MapTypes.NORMAL); }} /> { MapModule.setMapType(MapTypes.SATELLITE); }} />

a5adc5c9-098d-446a-ad46-8b901bbe2532

I try replace "BaiduMapViewManager extends SimpleViewManager" to "BaiduMapViewManager extends ViewGroupManager"
but all view i add is all under the the real BaiduMap render view, so they cannot display
我尝试将"BaiduMapViewManager extends SimpleViewManager"改成"BaiduMapViewManager extends ViewGroupManager"但是都失败了,因为百度地图实际的地图渲染层在我添加的按钮之上,导致他们无法显示
f8aa5125-ad20-45e9-9508-b3a35e7f85ef

By the way, this is the best baidumapkit i've ever used.
顺便,这是我用过的最好的百度地图控件了,

I hope that you could help me.
我希望你能帮助我

iOS的demo无法运行

/Users/lihaoran/Downloads/react-native-baidu-map-master/ios/RCTBaiduMap/BaseModule.h:12:9: 'RCTBridgeModule.h' file not found
/Users/lihaoran/Downloads/react-native-baidu-map-master/ios/RCTBaiduMap/RCTBaiduMapView.h:13:9: 'RCTViewManager.h' file not found

Undefined symbols for architecture arm64:

请问这个问题如何解决?
Undefined symbols for architecture arm64:
"_BMKConvertBaiduCoorFrom", referenced from:
-[GeolocationModule getBaiduCoor:lng:] in libRCTBaiduMap.a(GeolocationModule.o)
"_BMKCoorDictionaryDecode", referenced from:
-[GeolocationModule getBaiduCoor:lng:] in libRCTBaiduMap.a(GeolocationModule.o)
"_BMKCoordinateRegionForMapRectInternal", referenced from:
-[MapView updateTileLayerPara:] in BaiduMapAPI_Map(MapView.o)
-[BMKMapView initSubView] in BaiduMapAPI_Map(BMKMapView.o)
-[BMKMapView region] in BaiduMapAPI_Map(BMKMapView.o)
-[BMKMapView setVisibleMapRect:animated:] in BaiduMapAPI_Map(BMKMapView.o)
"_BMKGetMapApiBaseComponentVersion", referenced from:
_BMKCheckMapComponentIsLegal in BaiduMapAPI_Map(BMKMapVersion.o)
"_BMKGetNearestMapPointFromPolylineInternal", referenced from:
-[BMKMapView checkOnClickedOverlayView:] in BaiduMapAPI_Map(BMKMapView.o)
"_BMKMapRectContainsPointInternal", referenced from:
-[BMKMapView isUserLocationVisible] in BaiduMapAPI_Map(BMKMapView.o)
"_BMKMapRectIntersectsRectInternal", referenced from:
-[BMKPolyline intersectsMapRect:] in BaiduMapAPI_Map(BMKPolyline.o)
-[BMKMapView checkOverlayViews] in BaiduMapAPI_Map(BMKMapView.o)
"_BMKMapRectNull", referenced from:
-[BMKMapStatus init] in BaiduMapAPI_Map(BMKMapStatus.o)
-[BMKMultiPoint init] in BaiduMapAPI_Map(BMKMultiPoint.o)
-[BMKPolyline resetPoints:count:] in BaiduMapAPI_Map(BMKPolyline.o)
-[BMKPolyline initWithPoints:count:textureIndex:] in BaiduMapAPI_Map(BMKPolyline.o)
-[BMKPolygon resetPoints:count:] in BaiduMapAPI_Map(BMKPolygon.o)
BMKMapRectIntersectionT(BMKMapRect, BMKMapRect) in BaiduMapAPI_Map(BMKMapView.o)
"_BMKMapRectWorld", referenced from:
-[BMKTileLayer init] in BaiduMapAPI_Map(BMKTileLayer.o)
-[BMKMapView initSubView] in BaiduMapAPI_Map(BMKMapView.o)
"_BMPointMake", referenced from:

build说文件清单的Manifest错误

  • What went wrong:
    Execution failed for task ':app:processDebugManifest'.

    Manifest merger failed with multiple errors, see logs

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

运行报错

java.lang.ClassCastException: org.lovebing.reactnative.baidumap.BaiduMapViewManager cannot be cast to com.facebook.react.uimanager.ViewGroupManager

react-native的版本是0.31.0,不知道是为什么。

打包后不能运行

E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
Process: com.iprocesstask, PID: 29136
java.lang.NullPointerException: Attempt to invoke virtual method 'com.baidu.mapapi.map.BaiduMap com.baidu.mapapi.map.MapView.getMap()' on a null object reference
at org.lovebing.reactnative.baidumap.BaiduMapModule.getMap(BaiduMapModule.java:292)
at org.lovebing.reactnative.baidumap.BaiduMapModule.setMarker(BaiduMapModule.java:99)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:319)
at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:139)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
at android.os.Looper.loop(Looper.java:194)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
at java.lang.Thread.run(Thread.java:818)

rn 0.40 bugs

I met problem: Duplicate interface definition for class 'RCTBridge', and I solved it according to the article:facebook/react-native#11725, it was the problem of the changes in 0.40.

AK包名

申请百度AK时包名是用自已的还是 这边的?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.