使用Android Studio与ArcGIS Android SDK的开发环境部署和HelloWorld
android studio(以下简称AS)是google推荐的android专用IDE,替代目前主流的eclipse,另外arcgis也把AS作为推荐的android IDE
本文不介绍android SDK的部署和AS的安装
以下网站应该是AS的官方中国官网,有很多AS相关基础教程和AS的下载(不用翻墙下载了),强烈推荐
http://www.android-studio.org/
本文代码以arcgis android SDK中的arcgis-android-sdk-v10.2.4\samples\Maps\HelloWorld为基础
环境:Android SDK API 19,android studio 1.0,arcgis android SDK 10.2.4,小米4+MIUI v6
首先new一个project,一直next就行
新建project后,把这里切换到project
打开以下文件
把代码改为
package jls.as7; import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem; import com.esri.android.map.MapView; public class MainActivity extends Activity {
MapView mMapView; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); // After the content of this Activity is set, the map can be accessed programmatically from the layout.
mMapView = (MapView) findViewById(R.id.map);
} @Override
protected void onPause() {
super.onPause(); // Call MapView.pause to suspend map rendering while the activity is paused, which can save battery usage.
if (mMapView != null)
{
mMapView.pause();
}
} @Override
protected void onResume() {
super.onResume(); // Call MapView.unpause to resume map rendering when the activity returns to the foreground.
if (mMapView != null)
{
mMapView.unpause();
}
}
}
打开arcgis android SDK的压缩包,在libs目录下,找到如下几个jar包
复制到代码里如下目录
同样是arcgis SDK的libs目录下,把以下几个文件夹
复制到代码的如下目录(jniLibs目录默认不存在,要手动新建)
打开AndroidManifest.xml,在manifest节点下,添加如下内容
<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" />
打开moudle的build.gradle,在android节点下添加如下代码
packagingOptions {
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
到此配置完毕,插上手机,Run运行程序
最新文章
- CSS实现内容超过长度后以省略号显示
- 《1024伐木累》-te别篇,庭审你知道吗?
- 简单几何(直线与线段相交) POJ 1039 Pipe
- resolve some fragment exception
- Impala 5、Impala 性能优化
- lua语法 - 基础篇
- SDL2来源分析7:演出(SDL_RenderPresent())
- web开发性能优化---代码优化篇
- 如何在Eclipse中快速添加main方法
- emWin万年历,含uCOS-III和FreeRTOS两个版本
- hadoop集群完全分布式搭建
- Ubuntu安装tomcat
- Vue(十一)计算属性
- Content-Length mismatch, received 431737 bytes out of the expected 760836
- Flume参数小结
- revit API 生成墙图元
- [hadoop]hadoop api 新版本与旧版本的差别
- Java网络通信基础编程
- MySQL高级-主从复制
- TCP的3次握手和四次挥手,请画图说明流程
热门文章
- 【转】ACE编程小结
- [偏微分方程教程习题参考解答]4.1Duhamel 原理
- GC Buffer Busy Waits处理(转载)
- 我的格斗梦——张龙海(R.J)谈游戏动画师职业(转)
- 【leetcode】155 - Min Stack
- Who is the best at Dataset X?
- 构造数组的MaxTree
- 在IIS 中如何配置URL Rewrite,并且利用出站规则保持被重写的Cookie的域
- ubuntu cloud-archive 软件包 无法验证包来源
- Cocos2d-x项目移植到WinRT/Win8小记