##やりたい事
osmdrodを使用してAndroidアプリを作成しているのですが、
tileServerからデータを取得できません。
どうも、tileServerにアクセスする際にtimeoutが発生している様なのですが、
原因がわかりません。
なにが原因なのでしょうか?
https://github.com/osmdroid/osmdroid/wiki
を見ながらとりあえず地図が表示できるようにしようとしていました。
###発生している問題・エラーメッセージ
10-28 06:40:15.595 8518-8518/? I/art: Not late-enabling -Xcheck:jni (already on) 10-28 06:40:15.595 8518-8518/? W/art: Unexpected CPU variant for X86 using defaults: x86 10-28 06:40:15.670 8518-8518/com.example.ahiru.mapapptest W/System: ClassLoader referenced unknown path: /data/app/com.example.ahiru.mapapptest-1/lib/x86 10-28 06:40:15.712 8518-8518/com.example.ahiru.mapapptest I/InstantRun: Instant Run Runtime started. Android package is com.example.ahiru.mapapptest, real application class is null. 10-28 06:40:18.071 8518-8518/com.example.ahiru.mapapptest W/System: ClassLoader referenced unknown path: /data/app/com.example.ahiru.mapapptest-1/lib/x86 10-28 06:40:18.136 8518-8518/com.example.ahiru.mapapptest W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable 10-28 06:40:18.193 8518-8518/com.example.ahiru.mapapptest I/OsmDroid: Using tile source: Mapnik 10-28 06:40:18.202 8518-8579/com.example.ahiru.mapapptest D/OsmDroid: Local storage cahce purged 0 expired tiles in 0ms, cache size is 20480bytes 10-28 06:40:18.204 8518-8518/com.example.ahiru.mapapptest I/OsmDroid: sdcard state: mounted 10-28 06:40:18.208 8518-8518/com.example.ahiru.mapapptest I/OsmDroid: sdcard state: mounted 10-28 06:40:18.212 8518-8518/com.example.ahiru.mapapptest I/OsmDroid: sdcard state: mounted 10-28 06:40:18.233 8518-8518/com.example.ahiru.mapapptest D/Android: ACCESS_FINE_LOCATIONは許可されている 10-28 06:40:18.233 8518-8518/com.example.ahiru.mapapptest D/Android: ACCESS_WIFI_STATEは許可されている 10-28 06:40:18.234 8518-8518/com.example.ahiru.mapapptest D/Android: WRITE_EXTERNAL_STRAGEは許可されている 10-28 06:40:18.234 8518-8518/com.example.ahiru.mapapptest D/Android: ACCESS_COARSE_LOCATIONは許可されている 10-28 06:40:18.234 8518-8518/com.example.ahiru.mapapptest D/Android: ACCESS_NETWORK_STATEは許可されている 10-28 06:40:18.235 8518-8518/com.example.ahiru.mapapptest D/Android: INTERNETは許可されている 10-28 06:40:18.252 8518-8518/com.example.ahiru.mapapptest W/gralloc_ranchu: Gralloc pipe failed [ 10-28 06:40:18.252 8518: 8518 D/ ] HostConnection::get() New Host Connection established 0xa06a33c0, tid 8518 10-28 06:40:18.362 8518-8580/com.example.ahiru.mapapptest I/OpenGLRenderer: Initialized EGL, version 1.4 10-28 06:40:18.362 8518-8580/com.example.ahiru.mapapptest D/OpenGLRenderer: Swap behavior 1 10-28 06:40:18.426 8518-8518/com.example.ahiru.mapapptest I/OsmDroid: Tile cache increased from 9 to 72 10-28 06:40:18.465 8518-8607/com.example.ahiru.mapapptest D/NetworkSecurityConfig: No Network Security Config specified, using platform default 10-28 06:42:25.876 8518-8608/com.example.ahiru.mapapptest W/OsmDroid: IOException downloading MapTile: /9/450/201 : java.net.ConnectException: Connection timed out 10-28 06:42:25.876 8518-8607/com.example.ahiru.mapapptest W/OsmDroid: IOException downloading MapTile: /9/457/202 : java.net.ConnectException: Connection timed out
###該当のソースコード
public class MainActivity extends AppCompatActivity { private static final int PERMISSION_REQUEST_CODE = 100; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //パーミッションの確認 if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){ if(checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED){ //許可されている Log.d("Android","ACCESS_FINE_LOCATIONは許可されている"); }else{ //許可されていない Log.d("Android","ACCESS_FINE_LOCATIONは許可されていない"); requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION},PERMISSION_REQUEST_CODE); } if(checkSelfPermission(Manifest.permission.ACCESS_WIFI_STATE) == PackageManager.PERMISSION_GRANTED){ //許可されている Log.d("Android", "ACCESS_WIFI_STATEは許可されている"); }else{ //許可されていない Log.d("Android", "ACCESS_WIFI_STATEは許可されいない"); requestPermissions(new String[]{Manifest.permission.ACCESS_WIFI_STATE},PERMISSION_REQUEST_CODE); } if(checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED){ //許可されている Log.d("Android", "WRITE_EXTERNAL_STRAGEは許可されている"); }else{ //許可されていない Log.d("Android","WRITE_EXTERNAL_STRAGEは許可されていない"); requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},PERMISSION_REQUEST_CODE); } if(checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED){ //許可されている Log.d("Android", "ACCESS_COARSE_LOCATIONは許可されている"); }else{ //許可されていない Log.d("Android", "ACCESS_COARSE_LOCATIONは許可されていない"); requestPermissions(new String[]{Manifest.permission.ACCESS_COARSE_LOCATION},PERMISSION_REQUEST_CODE); } if(checkSelfPermission(Manifest.permission.ACCESS_NETWORK_STATE) == PackageManager.PERMISSION_GRANTED){ //許可されている Log.d("Android", "ACCESS_NETWORK_STATEは許可されている"); }else{ //許可されていない Log.d("Android", "ACCESS_NETWORK_STATEは許可されていない"); requestPermissions(new String[]{Manifest.permission.ACCESS_NETWORK_STATE},PERMISSION_REQUEST_CODE); } if (checkSelfPermission(Manifest.permission.INTERNET) == PackageManager.PERMISSION_GRANTED){ //許可されている Log.d("Android", "INTERNETは許可されている"); }else{ Log.d("Android", "INTERNETは許可されていない"); requestPermissions(new String[]{Manifest.permission.INTERNET},PERMISSION_REQUEST_CODE); } org.osmdroid.tileprovider.constants.OpenStreetMapTileProviderConstants.setUserAgentValue(BuildConfig.APPLICATION_ID); MapView map = (MapView) findViewById(R.id.map); map.setTileSource(TileSourceFactory.MAPNIK); map.setBuiltInZoomControls(true); map.setMultiTouchControls(true); map.setMaxZoomLevel(18); map.setMinZoomLevel(7); IMapController m_mapController; m_mapController = map.getController(); m_mapController.setZoom(9); double tempo_center_lat = 35.4579; double tempo_center_lng = 139.6323; GeoPoint center_gpt = new GeoPoint(tempo_center_lat, tempo_center_lng); m_mapController.setCenter(center_gpt); } } }
###試したこと
動作させているPCがプロキシサーバーを経由してネットに接続していることが原因である事が考えられたため、エミュレータにプロキシ設定を行ってみたが改善しませんでした。
###補足情報(言語/FW/ツール等のバージョンなど)
開発環境:AndroidStudio2.2.1
ターゲットSDK:API 24: Android 7.0 (Nougat)
osmdroid:'org.osmdroid:osmdroid-android:5.5:release@aar'
あなたの回答
tips
プレビュー