Coder Social home page Coder Social 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 Issues

打包后不能运行

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)

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.

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.

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)

android版本定位有时会失效

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

作者你好,我在真机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) => {
}}
>

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

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

地图显示空白,

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

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.
我希望你能帮助我

运行报错

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

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

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.

定位偏移很多

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

marker出现多个和重叠

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

后台运行问题

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

reverseGeoCode

Geolocation.reverseGeoCode(116.413369,39.910976);

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

这个好像是有问题的。

符号找不到

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

设置一样的markers出错

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

运行Android端 报错

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

运行作者的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的。有谁可以帮忙看看是什么原因么。

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:

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,在我手机上会出现两个信息框?

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

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

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

AK包名

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

找不到BaiduMapPackage

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

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.