我想在android应用程序中发布geosever图层,使用arcgis SDK,我已经完成了代码,但它不工作,请告诉我我做错了什么?

我想在android应用程序中发布geosever图层,使用arcgis SDK,我已经完成了代码,但它不工作,请告诉我我做错了什么?,android,geoserver,Android,Geoserver,我第一次做Android编程,我想用ArcGis SDK地图层显示一个GeoServer层。我已经做了代码,但它不工作,请告诉我我做错了什么 activity_main.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.co

我第一次做Android编程,我想用ArcGis SDK地图层显示一个GeoServer层。我已经做了代码,但它不工作,请告诉我我做错了什么

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.subrata.mymap.MainActivity">

<com.esri.android.map.MapView
    android:id="@+id/map"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    mapoptions.MapType="Aerial"
    mapoptions.center="28, 77"
    mapoptions.ZoomLevel="10">
</com.esri.android.map.MapView>
</RelativeLayout>

我真的不知道没有任何日志或解释就不工作是什么意思。 以下是一些可能的原因:

  • 无法访问url处的服务器
  • 图层名称NFR-SR:未找到山脊线
  • 地图服务不支持应用程序/openlayers
  • 它甚至可能正在工作,但您正在查看不包含任何数据的地图范围

  • 最有可能是1和3-除非您在手机上运行GeoServer,否则其地址将不是localhost
    package com.example.subrata.mymap;
    
    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.view.Menu;
    import android.view.MenuItem;
    import com.esri.android.map.MapView;
    import com.esri.android.map.ogc.WMSLayer;
    
    
    public class MainActivity extends AppCompatActivity {
    MapView mMapView;
    WMSLayer wmsLayer;
    String wmsURL;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    
        mMapView = (MapView)findViewById(R.id.map);
    
        wmsURL = "http://localhost:8081/geoserver/NFR-SR/wms";
        wmsLayer = new WMSLayer(wmsURL);
        wmsLayer.setImageFormat("application/openlayers");
        // available layers
        String[] visibleLayers = {"NFR-SR:Ridgeline_SR"};
        wmsLayer.setVisibleLayer(visibleLayers);
        wmsLayer.setOpacity(0.5f);
        mMapView.addLayer(wmsLayer);
    
    
        mMapView.setEsriLogoVisible(false);
        mMapView.enableWrapAround(true);
    }
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
       getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }
    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
    
        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }
    
        return super.onOptionsItemSelected(item);
    }
    }