2015-11-26 10 views
3

Я пытаюсь разработать приложение автономных карт, используя ArcGis android sdk. Последующие уроки с сайта ArcGis. Поскольку это приложение офлайн Maps Applicaion, я тестирую его без подключения к Интернету. Но, когда я запускаю приложение, MapView пуст. Он просто показывает черный экран. Когда я проверил LogCat, он говоритOffline Map using ArcGIS android SDK

11-26 14:39:57.757 28520-28520/com.example.lalprakash.offlinearcgismap D/GLSurfaceView: checkGLSurfaceViewlLogProperty get invalid command 
11-26 14:39:57.839 28520-28548/com.example.lalprakash.offlinearcgismap I/System.out: httpget:http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer?f=json 
11-26 14:39:57.840 28520-28548/com.example.lalprakash.offlinearcgismap I/System.out: http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer?f=json 
11-26 14:39:57.846 28520-28548/com.example.lalprakash.offlinearcgismap I/System.out: [CDS][DNS]Unable to resolve host "server.arcgisonline.com": No address associated with hostname 
11-26 14:39:57.846 28520-28548/com.example.lalprakash.offlinearcgismap E/ArcGIS: url =http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer 
11-26 14:39:57.884 28520-28520/com.example.lalprakash.offlinearcgismap V/PhoneWindow: DecorView setVisiblity: visibility = 4 ,Parent =null, this =com.android.internal.policy.impl.PhoneWindow$DecorView{41ce4470 I.E..... R.....ID 0,0-0,0} 
11-26 14:39:57.891 28520-28520/com.example.lalprakash.offlinearcgismap V/PhoneWindow: DecorView setVisiblity: visibility = 0 ,Parent =ViewRoot{41d35928 com.example.lalprakash.offlinearcgismap/com.example.lalprakash.offlinearcgismap.MainActivity,ident = 0}, this =com.android.internal.policy.impl.PhoneWindow$DecorView{41ce4470 V.E..... R.....ID 0,0-0,0} 

Я не могу понять, откуда, запрос server.arcgisonline.com собирается. Мой файл Java и файл XML являются

MainActivity.java

public class MainActivity extends Activity { 

    MapView mMapView; 
    String extern = Environment.getExternalStorageDirectory().getPath(); 
    final String tpkPath = "/ArcGIS/samples/OfflineRouting/ImageryTPK.tpk"; 
    TiledLayer mTileLayer; 
    GraphicsLayer mGraphicsLayer = new GraphicsLayer(GraphicsLayer.RenderingMode.DYNAMIC); 

    RouteTask mRouteTask = null; 
    NAFeaturesAsFeature mStops = new NAFeaturesAsFeature(); 

    Locator mLocator = null; 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_main); 

     mTileLayer = new ArcGISLocalTiledLayer(extern + tpkPath); 
     // Retrieve the map and initial extent from XML layout 
     mMapView = (MapView) findViewById(R.id.map); 

     // Set the tiled map service layer and add a graphics layer 
     mMapView.addLayer(mTileLayer); 
     mMapView.addLayer(mGraphicsLayer); 
    } 

} 

activity_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <com.esri.android.map.MapView 
     android:id="@+id/map" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     initExtent = "-1.3296373526814876E7 3930962.41823043 -1.2807176545789773E7 4201243.7502468005" 
     mapoptions.MapType="Topo" 
     mapoptions.ZoomLevel="16" /> 
</RelativeLayout> 

и build.gradle выглядит следующим образом

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.1" 

    defaultConfig { 
     applicationId "com.example.lalprakash.offlinearcgismap" 
     minSdkVersion 15 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
     sourceSets.main{ 
      jniLibs.srcDir 'src/main/jni' 
      jni.srcDirs=[] 
     } 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.1.1' 
    compile 'com.android.support:design:23.1.1' 
    compile files('libs/arcgis-android-api.jar') 
    compile files('libs/arcgis-android-app-toolkit.jar') 
    compile files('libs/jackson-all-1.9.0.jar') 
} 

Кроме того, я разместил файл tpk в корне моей внутренней памяти. Пожалуйста, помогите мне, поскольку мне это нужно очень плохо. Спасибо.

ответ

3

вы можете удалить initextent и mapoption.maptype от ур XML и скажите мне, что happens.i нету получили возможность взглянуть на ур трассировки стека, но это должно показать U ур карту на ур экран

+0

Thankyou @ Robel .. Теперь отображается карта. У меня есть еще одно сомнение. Как я покажу названия мест вместе с отображаемой картой. – Lal

+0

Я не понимаю, вы хотите скрыть места на карте? Но посмотрите образцы в примерах геокодирования, чтобы у вас была какая-то подсказка. –

+0

Что я имел в виду, я хочу, чтобы имена мест отображались вместе с карты, как в других онлайн-картах. – Lal