open street maps (osmdroid) shows grey tiles not map in PC

北城余情 提交于 2019-12-07 05:20:57

问题


I am using osmdroid to get open Street maps in my app. I had build my project with the needed jars (osmdroid) and added all needed permissions in the manifest. But when I try to debug my app in android emulator (adt eclipse) I am not able to see the map, only grey tiles. My project is working fine because if I debug in a smartphone I am able to see the map, the problem is only with the emulator.

I have done some research but I only found information of google maps solutions but not open street maps (osmdroid). Does somebody know how to solve this issue?

this is how I show the map in xml file

<org.osmdroid.views.MapView
        android:id="@+id/mapView"
        android:layout_width="fill_parent"
        android:layout_height="322dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true" >

        </org.osmdroid.views.MapView>

this is my main activity

mapView  = (MapView) findViewById(R.id.mapView);
    mapView.setTileSource(TileSourceFactory.MAPQUESTOSM);
    mapView.setBuiltInZoomControls(true);
    mapView.setMultiTouchControls(true);
    mapView.setUseDataConnection(true);

These are my permissions in manifest:

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> 
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" >

and the jars added to my build path

osmdroid-android-4.2.jar
osmdroid-thrid-party-4-2.jar
slf4j-1.7.7.jar

回答1:


I created an emulator with SD card and that solved the problem



来源:https://stackoverflow.com/questions/24655064/open-street-maps-osmdroid-shows-grey-tiles-not-map-in-pc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!