我正在尝试在我的应用程序中使用谷歌地图扩展。但是,当我尝试使用setClustering方法来处理Google对象时,它显示的不是解决错误,这意味着google类没有这个方法。
mMap.setClustering(new ClusteringSettings().enabled(false).addMarkersDynamically(true));但是,根据库文档,我必须这样使用。此外,可用的堆栈溢出回答也喜欢这种回答方式。
这是我的依赖
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'
}如何解决这个问题?
发布于 2018-05-27 07:54:18
GoogleMap应该是com.androidmapsextensions.GoogleMap而不是com.google.android.gms.maps.GoogleMap,检查您的导入。
com.androidmapsextensions.GoogleMap map;
map.setClustering(new ClusteringSettings().enabled(false).addMarkersDynamically(true));https://stackoverflow.com/questions/50549792
复制相似问题