【发布时间】:2015-01-18 12:22:59
【问题描述】:
我正在尝试在我的 Android 地图上绘制一条折线。我已阅读其他堆栈溢出答案,但他们没有纠正我的问题。我确实已将 google play 服务作为依赖项添加到我的应用程序中。
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.mattboyle.windowrunner"
minSdkVersion 21
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
//apply plugin: 'android-unit-test'
//afterEvaluate {
// tasks.findByName("assembleDebug").dependsOn("testDebugClasses")
//}
dependencies {
// compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.beardedhen:androidbootstrap:+'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.telly:groundy:1.5'
compile 'com.telly:groundy-compiler:1.5'
}
这是我非常简单的代码:
System.out.println("About to add to polyoptions");
PolylineOptions routeOption = new PolylineOptions().addAll(RunningMap.routeToPlot);
System.out.println("Added them all and routeoptions is of size "+routeOption.getPoints().size());
Polyline polyline = map.addPolyline(routeOption);
System.out.println("Should have plotted now..");
它击中了所有系统输出。
PolylineOptions.size() 返回 102 并且似乎没有任何其他错误。
地图已正确初始化,我可以在我的安卓屏幕上看到它。
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
.getMap();
这似乎应该可以工作,但我不明白为什么不能。我真的很感激任何建议。
【问题讨论】:
标签: android google-maps maps google-play-services