arcgis android 10.2.5开发环境配置

在android studio新建Android项目

 技术分享

最低sdk选4.0.3,arcgis android 10.2.5最低支持版本修改成了4.0了,如果没记错的话。

添加arcgis android 10.2.5的支持

官方指导链接:

https://developers.arcgis.com/android/guide/install-and-set-up.htm

修改项目的gradle文件

allprojects {

    repositories {

        jcenter()

        // Add the following arcgis repository

        maven {

            url http://dl.bintray.com/esri/arcgis

        }

    }

}

添加arcgis android  10.2.5的依赖

dependencies {

    ...

    // Add the ArcGIS Android 10.2.5 API

    compile com.esri.arcgis.android:arcgis-android:10.2.5

}

App module gradle文件

android {

    ...

    packagingOptions {

        exclude META-INF/LGPL2.1

        exclude META-INF/LICENSE

        exclude META-INF/NOTICE

    }

}

在AndroidManifest.xml file文件中添加

 

<uses-permission android:name="android.permission.INTERNET" />

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

 

    <uses-feature

        android:glEsVersion="0x00020000"

        android:required="true" />

开始项目

<com.esri.android.map.MapView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    />

Xml里加个地图控件

再加个地图显示看看

MapView mMapView;

ArcGISTiledMapServiceLayer tileLayer;

@Override

protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    mMapView=(MapView)findViewById(R.id.mapview);

    tileLayer = new ArcGISTiledMapServiceLayer(

            "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");

    // Add tiled layer to MapView

    mMapView.addLayer(tileLayer);

}

来加个helloworld试试

下面就真机测试跑起来看看咯

注意事项:

1.因为有底图的加载,所以需要网络访问,确保连接wifi或者数据网络

2.模拟器测试时候,请在模拟器创建选项中勾选 enable gpu

 技术分享

大功告成了

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。