2012-03-06 94 views
0

我使用omdroid 3.0.8測試一個非常簡單的OSM應用程序(並在實際的HTC Desire設備上測試)。 那是什麼,我試圖做的:OSM IO異常下載MapTile

final org.osmdroid.views.MapView mapView = new org.osmdroid.views.MapView(this, 256);       
setContentView(mapView);       
mMapView = mapView;        
final org.osmdroid.views.overlay.MyLocationOverlay mlo = new org.osmdroid.views.overlay.MyLocationOverlay(this, mapView);       
mapView.getOverlays().add(mlo);       
mMyLocationOverlay = mlo; 
mMapView.getController().setZoom(14);     
mMapView.getController().setCenter(new GeoPoint(52370816, 9735936));     
mMyLocationOverlay.disableMyLocation(); 

試圖讓OSM的MapView我在logcat中只得到一個網格和 「IO異常下載MapTile」:

03-06 14:22:43.444: D/dalvikvm(901): GC_FOR_MALLOC freed 1896 objects/766304 bytes in 61ms 
03-06 14:23:09.194: W/System.err(901): 310899 [downloader] WARN org.osmdroid.tileprovider.modules.MapTileDownloader - IOException downloading MapTile: /14/8636/5384 : java.net.SocketException: The operation timed out 
03-06 14:23:11.664: D/dalvikvm(901): GC_FOR_MALLOC freed 3009 objects/1169544 bytes in 66ms 
03-06 14:23:19.974: W/System.err(901): 321679 [downloader] WARN org.osmdroid.tileprovider.modules.MapTileDownloader - IOException downloading MapTile: /14/8636/5385 : java.net.SocketException: The operation timed out 
03-06 14:23:34.084: W/System.err(901): 335789 [downloader] WARN org.osmdroid.tileprovider.modules.MapTileDownloader - IOException downloading MapTile: /14/8636/5384 : java.net.SocketException: The operation timed out 
03-06 14:23:40.984: W/System.err(901): 342689 [downloader] WARN org.osmdroid.tileprovider.modules.MapTileDownloader - IOException downloading MapTile: /14/8635/5385 : java.net.SocketException: The operation timed out 
03-06 14:23:55.094: W/System.err(901): 356798 [downloader] WARN org.osmdroid.tileprovider.modules.MapTileDownloader - IOException downloading MapTile: /14/8633/5381 : java.net.SocketException: The operation timed out 

...等上。在設備上的網絡連接是好的,而且,使用相同地圖的OsmAnd應用程序沒有任何問題。 我需要在線獲取地圖,這就是要點。我如何從我的應用程序獲取OSM地圖?

+0

您是否在您的Manifest中設置了permission.Internet? – Thommy 2012-03-06 08:44:34

+0

當然我有。 – Jane 2012-03-07 06:06:28

回答

0

我修復了這個問題。它與權限連接 - SD卡上的OSM下載磁貼,因此需要WRITE_EXTERNAL_STORAGE權限。