The Squad Leader template demonstrates best practices for building handheld military applications with the ArcGIS Runtime SDK for Android. The Squad Leader template contains source code for a handheld application and directions for building the application from source. To download a precompiled distribution of the application, visit ArcGIS for Defense and Intelligence.
To run the app:
- Android 2.3.3 or higher
- Limited functionality when running on an Android emulator (more info)
To build the app from source:
- Android SDK
- Android API 14 or higher is required to build, even though the app will run on Android 2.3.3 (API 10) or higher
- ArcGIS Runtime SDK 10.2 (or higher) for Android
- Even if you have installed the Eclipse plugin from the online update site, you'll need to download the SDK to get the native binary files (see build steps).
- Eclipse 3.6.2 or higher (Eclipse for Android recommended)
- Android Support Library
- Clone this repository, or fork it and clone your fork.
- Download and install the ArcGIS Runtime SDK for Android,
- Unzip the SDK
- Copy the contents of the
arcgis-android-sdk/libs
directory from the SDK to your clone'ssource/SquadLeader/libs
directory. - NOTE: If app size is an issue and you know you don't need to run Squad Leader on a particular platform, you can omit one or more of the directories (armeabi, armeabi-v7a, x86).
- Get the latest military symbology files (mil2525c.dat, messagetypes/*.json):
- Clone the Esri/military-features-data repo, or fork it and clone your fork.
- Copy all the .json files from
Esri/military-features-data/data/mil2525c/messagetypes
to thesource/SquadLeader/assets/2525cSymDictionary/MessageTypes
directory in your Squad Leader clone. - Copy mil2525c.dat from
Esri/military-features-data/data/mil2525c
to thesource/SquadLeader/assets/2525cSymDictionary
directory in your Squad Leader clone.
- Check and if necessary install the Android Support Library v7 appcompat
- Follow the instructions on the Android support site for checking and/or adding the Android Support Library.
- To verify, from a command prompt, run android and observe the library is checked
- Open Eclipse for Android. Some IMPORTANT NOTES:
- When adding/importing projects to Eclipse ensure that you use the Android Import option: Android > Import Existing Android Code into Workspace.
- This can be found at File > Import > Android > Existing Android Code Into Workspace.
- When importing code, do not select/check the option copy the project to the workspace unless you know what you're doing.
- Once a project has been imported, verify that the Android Property Page contains no broken links. If so, you will need to remove and re-add the project.
- Add/import the Android Support Library v7 appcompat into your Eclipse Workspace
- In Eclipse import
{Android SDK Home}\sdk\extras\android\support\v7\appcompat
. - This provides a library project called android-support-v7-appcompat.
- In Eclipse import
- Add/import the aFileChooser project and check its properties
- The squad-leader-android repo contains the aFileChooser repo as a submodule in the source directory:
squad-leader-android\source\aFileChooser\aFileChooser
- Add/import the aFileChooser Eclipse Android project to the workspace
- Check the properties - right-click the project and choose Properties > Android. If any of the project's references are broken (e.g. android-support-v7-appcompat), remove it and re-add the reference.
- The squad-leader-android repo contains the aFileChooser repo as a submodule in the source directory:
- Add/import the SquadLeader project and check its properties
- Add/import the SquadLeader Eclipse Android project to the workspace from:
squad-leader-android\source\SquadLeader
- Check the properties - right-click the project and choose Properties > Android. If any of the project's references are broken (e.g. android-support-v7-appcompat, aFileChooser), remove it and re-add the reference.
- Ensure that the SquadLeader project is an ArcGIS Android Project. Right-click the project and choose ArcGIS Tools > Convert to ArcGIS Android Project if necessary.
- Add/import the SquadLeader Eclipse Android project to the workspace from:
- If any of the three projects (SquadLeader, android-support-v7-appcompat, aFileChooser) have errors, you may need to try the following:
- You may need to set the Android API level. Right-click the project and choose Properties > Android. Choose an Android API level 14 or higher. If you don't have API 14 or higher, install one in Eclipse by choosing Window > Android SDK Manager and selecting SDK Platform for API 14 or higher.
- Right-click the project and choose Android Tools > Fix Project Properties
- Right-click the SquadLeader project and choose ArcGIS Tools > Fix Project Properties - If ArcGIS Tools does not appear in the context menu, go back to the system requirements above and ensure you haved installed the ArcGIS Runtime SDK 10.2 for Android Eclipse Plugin.
- You may also need to clean and re-build the SquadLeader, aFileChooser, and/or android-support-v7-appcompat projects.
- To run directly from Eclipse
- Right-click the SquadLeader project and choose Run As > Android Application.
- If you wish to run in an emulator, see: Notes on Running with the Android Emulator
- To create an installer (.apk), right-click the project and choose Export. Choose Android > Export Android Application and step through the wizard.
- The following steps configure the project for building with ant.
- IMPORTANT NOTE: the ant and Eclipse configurations are not compatible so should not be used together (you should choose one or the other but not both).
- Configure Android, Java, and Ant to run from the command line
- It is assumed that users who select this option will be familiar with the steps necessary to configure these tools for command line usage (usually just adding the install directory to the path, e.g. for Android, set PATH=%PATH%;{ADT-Install}\sdk\tools)
- If not, please consult the documentation for each tool.
- To verify that your environment is correctly configured, from a command prompt enter the following and verify each command returns without errors:
> android -h
> java -version
> ant -version
- Perform Steps 1-4 from Building with Eclipse for cloning the projects and installing the support library.
- For each of the following projects:
{Android SDK Home}\sdk\extras\android\support\v7\appcompat
squad-leader-android\source\aFileChooser\aFileChooser
squad-leader-android\source\SquadLeader
- Do the following:
- Check/edit the project.properties file to ensure that it points to the correct folder(s)
- From the command line change to that directory and run the following command:
> android update project --path .
(Note: this will create an ant build.xml file in each project directory)
- Edit the file:
squad-leader-android\source\SquadLeader\custom_rules.xml
to point to the correct location of the ArcGIS for Android SDK install (this file is run as part of the build). - From
squad-leader-android\source\SquadLeader
, build using the desired ant task e.g. :>ant release
- NOTE: if you receive an error during build: "Could not reserve enough space for object heap," you may need to see the following environment variable from the command prompt:
> SET _JAVA_OPTIONS=-Xmx512M
- NOTE: if you receive an error during build: "Could not reserve enough space for object heap," you may need to see the following environment variable from the command prompt:
- Follow the Building with Eclipse steps above.
- In the same Eclipse workspace, add/import the project found at
source/SquadLeader/tests
. The project name is SquadLeaderTest. - To run the SquadLeaderTest project, right-click the project and choose Run As > Android JUnit Test.
- If you wish to run in an emulator, see: Note on Running with the Android Emulator
- Once you have configured the project for building with ant
>ant debug install test
- Like any app using ArcGIS Runtime for Android, Squad Leader can run on an Android emulator.
- If you wish to run in an emulator, you must follow the directions in this blog post to ensure that the emulator has proper hardware GPU support.
- A sample emulator configuration is shown at (documentation/dev-screen-shots/SampleEmulator.jpg)
- IMPORTANT NOTE: the Android emulator runs in a firewall-restricted sandbox that cannot communicate over UDP with outside processes, meaning you cannot send or receive Geomessages (spot reports, etc.) from or to Squad Leader running on an emulator.
Squad Leader leverages the following as submodules of the squad-leader-android repository.
If you should want to update to the latest commit instead of the commit used by the squad-leader-android commit you're using, you can open a GitHub shell in squad-leader-android and run the following:
$ cd .\source\military-apps-library-java
$ git pull origin master
More information for configuring and running the application see the User Guide
- Learn more about Esri's ArcGIS for the Military solution.
Find a bug or want to request a new feature? Please let us know by submitting an issue.
See Issues for a list of known issues.
Esri welcomes contributions from anyone and everyone. Please see our guidelines for contributing.
Copyright 2013 Esri
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
A copy of the license is available in the repository's license.txt file.
Portions of this code use other Esri libraries, also governed by the Apache License:
- military-apps-library-java
Portions of this code use third-party libraries:
- Use of aFileChooser is governed by the Apache License.
- Use of the JSON Java library available at http://www.json.org/java/index.html is governed by the JSON License.
See license-ThirdParty.txt for the details of these licenses.
[](Esri Tags: ArcGIS Defense and Intelligence Military Defense Portal Android) [](Esri Language: Java)