Mapbox for Android:当我导入 markerview 依赖时,我的原始地图代码停止工作。

huangapple 未分类评论62阅读模式
英文:

Mapbox for android: when I import markerview dependancy, my original mapbox map code stops working

问题

我一直在使用Mapbox的教程等来编写代码,创建地图并获取用户位置。为了实现这个目的,我一直在使用以下这些依赖:

implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:6.0.1'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-locationlayer:0.5.0'

接下来,我想编写一个能够添加标记的代码,因此我导入了下面显示的依赖:

implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-markerview-v9:0.4.0'

我注意到一旦这样做,addLocationListener() 方法不再被找到,getLastLocation 方法也不起作用了,似乎它们现在需要一些参数,而之前不需要。我想知道是否有人遇到过类似的问题,并且能够提供如何解决的建议。谢谢!

英文:

I have been using Mapbox tutorials and etc., to write a code that creates a map and and finds user's location. 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'

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'

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. I wonder if anyone had similar problem and could advice how to solve this. Thanks!

答案1

得分: 0

我会使用最新的地图 SDK 版本 9.2.0链接

定位图层插件已经被弃用。链接

我会使用 LocationComponent 替代它。它是地图 SDK 的一部分。链接1链接2

MarkerView 仍然可用,但它可能会因为使用了 Android 系统的 View 而导致一些性能问题。相反,考虑使用地图 SDK 的 SymbolLayer 链接 或者注释插件 链接

英文:

I'd use the latest Maps SDK version 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/

I'd use the LocationComponent instead. 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

The MarkerView is still useable, but it'll have some performance issues because it uses Android-system Views. 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/

huangapple
  • 本文由 发表于 2020年6月29日 03:54:27
  • 转载请务必保留本文链接:https://java.coder-hub.com/62627560.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定