Google map setClustering(ClusteringSettings) 方法未解析
Google map setClustering(ClusteringSettings) method not resolving
我正在尝试在我的应用中使用 Google Maps Extension。但是当我尝试对我的 Google Map 对象使用 setClustering 方法时,它显示没有解决错误,这意味着 google map class 没有这个方法。
mMap.setClustering(new ClusteringSettings().enabled(false).addMarkersDynamically(true));
但是,根据图书馆文档,我必须这样使用。此外,可用的 Whosebug 答案也采用这种 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'
}
如何解决这个问题?
GoogleMap
应该是 com.androidmapsextensions.GoogleMap
而不是 com.google.android.gms.maps.GoogleMap
检查你的导入。
com.androidmapsextensions.GoogleMap map;
map.setClustering(new ClusteringSettings().enabled(false).addMarkersDynamically(true));
我正在尝试在我的应用中使用 Google Maps Extension。但是当我尝试对我的 Google Map 对象使用 setClustering 方法时,它显示没有解决错误,这意味着 google map class 没有这个方法。
mMap.setClustering(new ClusteringSettings().enabled(false).addMarkersDynamically(true));
但是,根据图书馆文档,我必须这样使用。此外,可用的 Whosebug 答案也采用这种 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'
}
如何解决这个问题?
GoogleMap
应该是 com.androidmapsextensions.GoogleMap
而不是 com.google.android.gms.maps.GoogleMap
检查你的导入。
com.androidmapsextensions.GoogleMap map;
map.setClustering(new ClusteringSettings().enabled(false).addMarkersDynamically(true));