arcgis android 10.2.5开发环境配置

 

android里要添加arcgis android 的支持,其实本质是添加了jar包,so库,清单文件里申请了权限而已。

插件是为了方便创建arcgis android工程,然后并没有什么卵用。

arcgis官方表示,10.2.5版本和以后的版本都不会出eclipse插件。

在android studio里开发,可以手动添加jar包到项目里,即在项目里建一个libs文件夹,然后依赖的库全放进去。,gradle里设置下


 

下面介绍官方推荐的,而且就本人看来更优雅的gradle添加依赖的方法。

 

首先在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'

        }

    }

}
复制代码

在项目的gradle文件中添加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

 

大功告成了

posted @   江海不系舟  阅读(2769)  评论(0编辑  收藏  举报
编辑推荐:
· 软件产品开发中常见的10个问题及处理方法
· .NET 原生驾驭 AI 新基建实战系列:向量数据库的应用与畅想
· 从问题排查到源码分析:ActiveMQ消费端频繁日志刷屏的秘密
· 一次Java后端服务间歇性响应慢的问题排查记录
· dotnet 源代码生成器分析器入门
阅读排行:
· ThreeJs-16智慧城市项目(重磅以及未来发展ai)
· .NET 原生驾驭 AI 新基建实战系列(一):向量数据库的应用与畅想
· Ai满嘴顺口溜,想考研?浪费我几个小时
· Browser-use 详细介绍&使用文档
· 软件产品开发中常见的10个问题及处理方法
点击右上角即可分享
微信分享提示