【问题标题】:Google map setClustering(ClusteringSettings) method not resolving谷歌地图 setClustering(ClusteringSettings) 方法无法解决
【发布时间】:2018-11-06 01:39:07
【问题描述】:

我正在尝试在我的应用程序中使用 Google Maps Extension。但是当我尝试对我的谷歌地图对象使用 setClustering 方法时,它显示未解决错误,这意味着谷歌地图类没有这个方法。

mMap.setClustering(new ClusteringSettings().enabled(false).addMarkersDynamically(true));

但是,根据库文档,我必须像这样使用。此外,可用的 Stackoverflow 答案也确实像这种answer 方式。

这是我的依赖

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:27.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7:27.+'
compile 'com.android.support:design:27.+'
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.google.android.gms:play-services-location:12.0.1'
compile 'com.google.android.gms:play-services-maps:12.0.1'
compile 'com.google.android.gms:play-services-places:12.0.1'
compile 'com.androidmapsextensions:android-maps-extensions:2.4.0'
testCompile 'junit:junit:4.12'
}

如何解决这个问题?

【问题讨论】:

    标签: android google-maps google-maps-api-2


    【解决方案1】:

    GoogleMap 应该是 com.androidmapsextensions.GoogleMap 而不是 com.google.android.gms.maps.GoogleMap 检查您的导入。

    com.androidmapsextensions.GoogleMap map;
    
    
    
     map.setClustering(new ClusteringSettings().enabled(false).addMarkersDynamically(true));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-03-06
      • 1970-01-01
      • 2014-05-21
      • 1970-01-01
      • 2011-02-04
      • 2016-04-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多