ArcGIS Runtime SDK for Android 10.2. Version 5 was released a year ago, and one of the major changes is that the new version uses the new development environment, and in 10.2.5, ESRI uses the new, officially available Android development tool A Ndroid Studio, keeping up with the pace of the Times, and ArcGIS Runtime SDK for Android created Esri's own maven repository on the Bintray platform. On the Bintary platform, we can quickly and easily release our own software version, and most of all, Esri's Android project is now built on a tall gradle, creating a Gradle project between us through Android studio, Let's look at how to build the new ArcGIS Runtime SDK forandroid development environment.
1 IDE Get
Google's official development recommendations for Android using the Android studio Tools, which advantages of the tool is not discussed here, interested can go to Baidu or Google search, in addition to Android Studio we can of course also use the IntelliJ Idea development tool, but IntelliJ idea is a toll-free tool, listed below for these two tools:
: http://developer.android.com/sdk/index.html
- Intellij IDE l Intellij idea
:http://www.jetbrains.com/idea/download/
1 IDE Installation
Installation procedures are general, double-click the Androidstudio installation program, using the default installation directory, click Next to complete. The installation process is as follows:
Click Finish to complete the installation
Select the first item to configure:
1 Gradle Configuration
Gradle is a popular system building tool recently, you can customize the build process by compiling your own build files (build.gradle). The build file for a Gradle project is located at the root of the project, and you can find the build file (Build.grade) under the project's root directory. When developing an ArcGIS for Android Gradle project, you need to configure two parts of the dependency management content:
1) Configure the Arcgisrepository (Esri ArcGIS maven) warehouse location for Project
2) Configure Appmodule ArcGIS Runtime SDK for Android dependent.
1.1 ArcGIS Repository configuration
Open the build configuration file Build.gradle file under the root directory and add the warehouse configuration as follows:
allprojects {
repositories {
Jcenter ()
Add the following ArcGIS repository
Maven {
URL ' Http://dl.bintray.com/esri/arcgis '
}
}
}
is not very simple, so that the ArcGIS jar package you need will be automatically downloaded to the local repository, the next time you build a project to reference the ArcGIS jar, he will go to your local directly to find the relevant jar introduced into your project, is not very convenient.
1.2 App Module Configuration
the Build.gradle file in App module is suitable for special commands and tasks. An ArcGIS Android app requires the ArcGIS Android API Library Engineering AAR bundle. Once you have configured the ArcGIS repository in the project level Build.gradle file, you can then declare the dependencies of ArcGIS Android in this file.
1.2.1 ArcGIS Dependency configuration
dependencies {
...
Add the ArcGIS Android 10.2.5 API
Compile ' com.esri.arcgis.android:arcgis-android:10.2.5 '
}
The ArcGIS jar is referenced for project compilation.
1.2.2 Packaging Configuration
We may not want to pack some files into the apk when we build the APK, so we can exclude the required files from the APK file using the following configuration:
packagingoptions{
Exclude ' meta-inf/lgpl2.1 '
Exclude ' meta-inf/license '
Exclude ' meta-inf/notice '
}
1.2.3 Permissions and features configuration
for the vast majority of ArcGIS Androidapps applications almost all require network support, and some applications may require access to the device's sdcard, need to have read and write permissions to the card, in addition to the most common function of GIS is to locate all, The app should have location permissions. The Mapview for ArcGIS Android apps uses opengl2.x, so you'll need to add OpenGL support in the configuration file, so your app's profile contains at least the following configuration information:
<uses-permissionandroid:name= "Android.permission.INTERNET"/>
<uses-permissionandroid:name= "Android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permissionandroid:name= "Android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature
android:glesversion= "0x00020000"
Android:required= "true"/>
OK to the end of this environment configuration, no need to copy jar everywhere is not very happy.
ArcGIS Runtime SDK for Android 10.2.5 New development Platform Installation configuration Guide