June 28, 2013

Getting started with ODK - Install Android Emulator

Following this tutorial

Make sure you have all the Java requirements:
$ sudo apt-get install openjdk-6-jre openjdk-6-jdk icedtea6-plugin

Download the SDK tools (not the ADT bundle)

Unpack the tar ball
$ cd ~/
$ sudo tar -xzf Downloads/android-sdk_r22.0.1-linux.tgz

Fix permissions (?)
$ sudo chown -R mobile1:mobile1 android-sdk-linux/

Run Installer
$ cd android-sdk-linux/tools
$ ./android

Error: Missing platform-tools (uhoh?)

Install updates whenever prompted

Edit bashrc
$ cd ~/
$ sudo nano .bashrc

Add this to bottom:
export PATH=${PATH}:~/android-sdk-linux/tools
export PATH=${PATH}:~/android-sdk-linux/platform-tools

Reload bashrc
$ source ~/.bashrc

Open the emulator
$ android avd

And create a new phone. Promptly get errors

Starting emulator for AVD 'mobile1' Failed to load libGL.so error libGL.so: cannot open shared object file: No such file or directory Failed to load libGL.so error libGL.so: cannot open shared object file: No such file or directory

Fix error:
$ sudo apt-get install libgl1-mesa-dev

Posted by kkwaiser at 12:25 PM | Comments (0)

Getting started with ODK - Build a Survey

Once ODK Aggregate is set up, the next step is to build a survey form.

The simplest way to build a test form is to use Build which is a offers a GUI platform via a website that builds the xml spec for you. For more complicated forms the suggestion is to use XLSForm which allows you to specify the form via an Excel form and then convert that to the required XML.

Copy and paste the instructions:

Using the Application

1. Please read all the instructions and notes before beginning.
2. Go to http://build.opendatakit.org and sign in.
3. Add a new prompt, by dragging the elements from the bottom of the screen onto the blank canvas.
4. For each prompt, modify its properties on the right portion of the screen.
5. Prompts can also be rearranged through drag and drop.
6. When the form is finished, go to the File menu, Save and then Export to XML.

Posted by kkwaiser at 12:04 PM | Comments (0)

June 26, 2013

Getting started with ODK - Install Aggregate on Ubuntu 12

1. Install Ubuntu 12.04 (LTS) on a Virtual Machine
2. Install Java
$ sudo apt-get install sun-java6-jdk

3. Install Tomcat Webserver
$ sudo apt-get install tomcat6
Decent config instructions
Visit http://localhost:8080/

- Set some global variables (unsure of how important this step is!
$ sudo nano ~/.bashrc

Add this to bottom

export JAVA_HOME=/usr/lib/jvm/java-6-openjdk
export CATALINA_HOME=/usr/share/tomcat6
export CATALINA_OUT=/var/log/tomcat6/catalina.out
export CATALINA_BASE=/var/lib/tomcat6/webapps

4. (Optional) Install XFCE to speed up VM
$ sudo apt-get install xfce4 xfce4-goodies
- add terminal shortcut:
Settings>>Keyboard Settings and add the following four shortcuts
Code: xfce4-terminal Ctrl+alt+x
- add workspace application shortcut
Go to Xfce4 parameters > window manager settings > Keyboard tab

5. Install MySQL Server
$ sudo apt-get install mysql-server

6. Run ODK Aggregator configuration script
Download the correct version (linux 32 bit in this case).
$ cd ~/Downloads
$ chmod +x ODK\ Aggregate\ v1.3.1\ linux-installer.run
$ ./ODK\ Aggregate\ v1.3.1\ linux-installer.run

- Set Parent Directory to ~/
- Platform: MySQL
- No SSL (for now)
- HTTP Port: 8080
- IP Address or DNS: localhost

- Download MySQL Connector (http://dev.mysql.com/downloads/connector/j/5.1.html
$ cd ~/Downloads
$ sudo tar -xzf mysql-connector-java-5.1.25.tar.gz
$ sudo cp mysql-connector-java-5.1.25/mysql-connector-java-5.1.25-bin.jar /usr/share/tomcat6/lib/

- Database Port: 3306
- Database Host:

7. Set up database (run script)
$ mysql --user root --password
mysql> source /home/mobile1/ODK Aggregate/create_db_and_user.sql
mysql> exit

8. Place war file on web server

$ cd ~/ODK Aggregate
$ sudo cp ODK\ Aggregate/ODKAggregate.war /var/lib/tomcat6/webapps/
- the war file should automagically unpack and create an ODKAggregate directory. If this does not happen, something is messed up with your Java install or something ;)

9. Visit http://localhost:8080/ODKAggregate
- Loging with Google identity
- ???
- Profit!

10. Now what to do?


Install the emulator

User tutorial

Install Aggregate

Install Collect

Install Tomcat

Potentially useful blurb:

You can't just copy the aggregate folder, as it has embedded within it the fully-qualified hostname and ports used to communicate with the server on which it is deployed. Either run the installer to generate an appropriate war file for the new hostname, ports and database, or, to do it manually, the relevant file to change is .../WEB-INF/lib/odk-settings.jar (this is what is created during the install process). The relevant files to change within that jar are (1) jdbc.properties -- to alter what database is being used and (2) server.properties -- to alter what hostname, port, etc. is used when interacting with the server.

Posted by kkwaiser at 10:57 AM | Comments (0)