Appcelerator titan - Android 上的 MapView 导致应用程序崩溃
我正在尝试使用以下代码在 android 模拟器上显示地图:
var window = Ti.UI.createWindow();
window.open();
var mapView = Ti.Map.createView({
mapType: Ti.Map.STANDARD_TYPE,
region:{
latitude:33.74511, longitude:-84.38993,
latitudeDelta:0.5, longitudeDelta:0.5
},
animate:true,
regionFit:true,
userLocation:true
});
window.add(mapView);
alert(mapView)//outputs Ti.Map.View
我已完成此处提到的所有步骤 http://wiki.appcelerator.org/display/guides/Maps+for+Android 但应用程序崩溃了。有谁知道可能是什么原因造成的?
谢谢
am trying to display a map on android emulator, using the following code:
var window = Ti.UI.createWindow();
window.open();
var mapView = Ti.Map.createView({
mapType: Ti.Map.STANDARD_TYPE,
region:{
latitude:33.74511, longitude:-84.38993,
latitudeDelta:0.5, longitudeDelta:0.5
},
animate:true,
regionFit:true,
userLocation:true
});
window.add(mapView);
alert(mapView)//outputs Ti.Map.View
I have made all the steps mentioned here http://wiki.appcelerator.org/display/guides/Maps+for+Android
but the application crashes. Does anyone has an idea what might be causing this?
thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果没有崩溃的堆栈跟踪,我只能猜测它是由不提供 Google Maps API 的模拟器引起的。请参阅 http://developer.appcelerator.com/question/ 121105/使用地图时 Android 崩溃
Without a stacktrace of your crash I can only guess it's caused by an emulator which does not provide the Google Maps API. See http://developer.appcelerator.com/question/121105/crash-in-android-when-using-maps
尝试从 tiapp.xml 文件中删除这里的密钥,然后刷新 android 模拟器,它会工作,但会重置为空的 google 界面,任何人都有任何想法
try removing the your key here from the tiapp.xml file then refreshing the android emulator and it will work but resets to the empty google interface anybody got any ideas
您可能在代码中的其他位置创建了其他地图视图。在这种情况下,Google 不允许这样做,您最终会强制关闭 (
IllegalStateException
)You may have created other Map views elsewhere in your code.In that event,Google doesnt allow that and you end up with a force close (
IllegalStateException
)