[英]Mapbox for android: when I import markerview dependancy, my original mapbox map code stops working
I have been using Mapbox tutorials and etc., to write a code that creates a map and and finds user's location.我一直在使用 Mapbox 教程等,编写创建 map 并找到用户位置的代码。 For this purpose i have been using these dependencies:
为此,我一直在使用这些依赖项:
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:6.0.1' implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-locationlayer:0.5.0'实施 'com.mapbox.mapboxsdk:mapbox-android-sdk:6.0.1' 实施 'com.mapbox.mapboxsdk:mapbox-android-plugin-locationlayer:0.5.0'
What I wanted to do next was to write a code when I could add markers, for this reason I have imported the dependency shown below:接下来我想做的是在可以添加标记时编写代码,因此我导入了如下所示的依赖项:
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-markerview-v9:0.4.0'实现 'com.mapbox.mapboxsdk:mapbox-android-plugin-markerview-v9:0.4.0'
I have noticed that once I do this the method addLocationListener() is not found anymore, and getLastLocation methods are also not working and seems they require some parameters now which was not necessary before.我注意到,一旦我这样做了,方法 addLocationListener() 就找不到了,getLastLocation 方法也不起作用,似乎它们现在需要一些以前不需要的参数。 I wonder if anyone had similar problem and could advice how to solve this.
我想知道是否有人有类似的问题并可以建议如何解决这个问题。 Thanks!
谢谢!
I'd use the latest Maps SDK version 9.2.0
https://docs.mapbox.com/android/maps/overview/我会使用最新的地图 SDK 版本
9.2.0
https://docs.mapbox.com/android/maps/overview/
The Location Layer Plugin is deprecated: https://docs.mapbox.com/android/plugins/overview/location-layer/位置层插件已弃用: https://docs.mapbox.com/android/plugins/overview/location-layer/
I'd use the LocationComponent
instead.我会改用
LocationComponent
。 It's a part of the Maps SDK: https://docs.mapbox.com/android/maps/overview/location-component and https://docs.mapbox.com/android/maps/examples/#device-location它是地图 SDK: https://docs.mapbox.com/android/maps/overview/location-component和Z5E056C500A1C4B6A7110B50B50D807BADE5Z/ example.com 的一部分。
The MarkerView is still useable, but it'll have some performance issues because it uses Android-system View
s. MarkerView 仍然可以使用,但它会出现一些性能问题,因为它使用 Android 系统的
View
。 Instead, consider using the Maps SDK SymbolLayer
https://docs.mapbox.com/android/maps/overview/data-driven-styling/#symbol or the Annotation Plugin https://docs.mapbox.com/android/plugins/overview/annotation/ Instead, consider using the Maps SDK
SymbolLayer
https://docs.mapbox.com/android/maps/overview/data-driven-styling/#symbol or the Annotation Plugin https://docs.mapbox.com/android/plugins/概述/注释/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.