Chapter 2 - Installation
This document will guide you through installing everything that is needed to develop Android applications with jadex-android.
Please report any difficulties or errors in this document aswell as in the provided jadex-android libraries.
You have multiple Options:
- If you don't use eclipse or maven, just follow step 1.
- If you want to use eclipse, but not maven, follow step 1 and 2.
- If you want to use eclipse and maven, follow step 1, 2 and 3.
- To compile the example project with eclipse and maven, follow steps 1-4.
- To compile the example project with eclipse without maven follow steps 1,2 and 5.
You can also compile the example project without using eclipse by following steps 1 and 3 and then manually starting the maven build (mvn package).
Step 1
To develop Android applications with jadex-android you need to:
- Install the Android SDK (from http://developer.android.com/sdk/index.html)
- Download the SDK Platform API for Android 2.2 or higher using the Android SDK Manager
- Download and extract jadex-android (Nightly Builds)
Proceed to the next step if you want to use Eclipse OR start using jadex-android by adding the libraries in the extracted folder lib to your projects build path
Step 2
In order to develop Android applications using Eclipse (with or without maven), you need:
- Eclipse 3.6 or newer (http://www.eclipse.org/downloads/)
- The Android Developer Tools (ADT), Eclipse Update Site: https://dl-ssl.google.com/android/eclipse/
- In Eclipse, set the path to the Android SDK in Window -> Preferences -> Android and click Apply
Proceed to the next step if you wish to use maven OR to step 5 if you don't.
Step 3
If you want to use Maven as Build System (required for the included example project):
NOTE: Currently (2011-10-31), the M2E-Android Plugin doesn't work together with ADT / Android SDK R13 or newer. A fix is beeingworked on. Use R12 for now if you need Maven/Eclipse support. Update: this is fixed with jadex-android 0.0.4.
- set the $ANDROID_HOME environment variable to the directory where the Android SDK is located
- install a JDK (not JRE), available at http://www.oracle.com/technetwork/java/javase/downloads/index.html
- configure Eclipse to run with a JDK (http://matsim.org/node/372) and set a JDK as default JRE (Window -> Preferences -> Java -> Installed JREs, add your JDK here and check it)
- Eclipse 3.6 users: install m2eclipse plugin, eclipse update site: http://download.eclipse.org/technology/m2e/releases
Because jadex-android artifacts are not available through a maven repository yet, you need to install those manually in your local maven repository:
- download and install Maven (http://maven.apache.org/download.html)
- unpack the sources.zip which is included in the jadex-android distribution.
- open a terminal emulator (windows: cmd), change to the extracted sources directory, and run: mvn package install -P jadex-android-artifacts (maybe you need to substitute mvn with the path to the mvn executable you installed before)
- the jadex-android artifacts are now installed in your local maven repository and can be accessed within every maven project
Step 4
To import the maven sample project in eclipse (after following steps 2 and 3)
- extract the jadex-android-example-projects.zip, which is included in the jadex-android distribution
- copy the jadex-android-example-project-maven directory to your workspace
- choose File -> Import -> Maven -> Existing Maven Projects
- select your workspace folder, select the jadex-android-example-project-maven directory and click next / finish until import is completed
- you will be prompted to install some Eclipse Plugins (m2e android connector) and to restart eclipse
- after restarting, the project should build without any errors
- Starting from Version 2.1, the eclipse build will work (just click run as Android Application), if eclipse hangs see Hints on the bottom of this page
- to build the project with maven (for jadex-android < 2.1), use the included launch config Build example project with maven
- to run the maven build, use the included launch config Run example project with maven, which will deploy and run the project on any android devices plugged in or emulators running. (Currently, running doesn't work, but deploying does, so launch the application manually)
Step 5
To import the non-maven sample project in eclipse (after following step 1 and 2)
- extract the jadex-android-example-projects.zip, which is included in the jadex-android distribution
- select File -> Import -> General -> Existing Projects into Workspace
- locate the extracted jadex-android-example-project directory
- optionally check copy projects to workspace
- click Finish
- copy the jadex-android libraries to the lib directory of the project and add them to the projects build path (you could skip jadex-android-bdi, bpmn and bdibpmn as the sample only uses a MicroAgent)
- project should compile without errors
Hints
- if Eclipse cannot find a suitable M2E connector and you already have an older version of m2e-android installed, try updating it manually using the Eclipse Installer and the following Update Site: http://rgladwell.github.com/m2e-android/updates/
- if you get Exceptions related to memory ("Out of Heap Space", "GC overhead limit") during compilation, try setting -Xms128m -Xmx1024m in your eclipse.ini
- bug in m2e-android (https://github.com/rgladwell/m2e-android/issues/31)
NIOTCP Transport doesn't work in a 2.2 emulator, see http://code.google.com/p/android/issues/detail?id=9431Update (Feb. 2012): This is now fixed, NIOTCP was now successfully tested with FroYo (Android 2.2) and Gingerbread (Android 2.3).