Add New Page: You are not allowed to add pages Select section/namespace. New page title.
 

Commotion Android build-install-testing

FAQs

Experimenting with building and installing the Commotion Android application from the instructions in the readme.

answered by Hans

_Initially the make build for the Android app was failing. I eventually realized that the Makefile conditionally assigns 9 as the Android SDK platform in line 11: SDK_PLATFORM_LEVEL ?= 9. From what I read 9 is obsolete. The build ran sucessfully with platform level 16. Which SDK API Level should I be using?_

Either should be fine. Originally Android build systems seemed to work best if you put the oldest supported version in that field. Now they seemed to have changed their minds and say you should put the newest supported version. If you want to compiled for android-9, you just have to install the android-9 stuff in the android updater.

_I had to explore quite a bit of the Android Developers documentation to fill in the gaps of the Readme instructions. Including setting up device detecting on Ubuntu. Are there other Commotion Android resources (besides the readme) that provide instructions on testing or troubleshooting?_

The README assumes that you have a fully working Android development setup. Otherwise we'd have to maintain a duplicate set of instructions as Google's.

_After installing the app on two HTC mobile devices, we tested them and they are either crashing or not fully functional. What is the best way for me to debug this? Should I run the app with adb logcat and share my findings on this commotion-dev? Is the commotion-android listserv not in use?_

Post here on commotion-dev. I'm the main author of the Commotion MeshTether, and that's the first I've heard of the commotion-android list :)

The crashes should give you a stacktrace in logcat, that's a good place to start. Post anything here that you want to discuss.

Right now the known working devices are HTC running Android 2.x some random others. It works on my Motorola Droid running CyanogenMod, and I can sometimes get it working on my Samsung Galaxy Player 5.0 running 2.3.3. Will is currently working on 4.x support.

Guide

written during java code documentation project by James McMullen / Work Dept

Introduction

The following notes were collected while installing the Commotion code base on a couple of new machines (OSX & Ubuntu), building it, deploying the Android application (not quite successfully), & generating Javadoc. The advice recorded here was culled from README files, source code comments, git checkin comments, numerous websites, & plenty of trial & error. Especially error.

Commotion consists of 2 Eclipse projects - commotion-android & Shell. commotion-android is the UI, which includes about 5 activity views presented to the user.

Shell is a service (which in Android runs in the same thread as the host application) that can continue running & servicing remote clients even when the app is dismissed from the display.

commotion-android & Shell are combined in a single deployment. Shell.jar is built into commotion-android's asset folder.

Prerequisites

The development environment includes Eclipse, the Android SDK with its Eclipse plugin, the Android NDK (r4 or above). A guide to installing these components is at http://developer.android.com/sdk/installing/bundle.html

It may be helpful to explicitly identify the SDK's location in the shell variables SDK_BASE & NDK_BASE, & to call out which version of each you wish to build with. For instance, add something like this to ~/.bashrc:

export SDK_BASE=~/android/adt-bundle-linux-x86/sdk
export NDK_BASE=~/android/android-ndk-r8d
export SDK_PLATFORM_LEVEL=16
export NDK_PLATFORM_LEVEL=9s

Other necessary tools can be installed with:

sudo apt-get install bison flex make sed junit4

Commotion uses git on github for source control. There are 2 repositories:

Create a folder for the source tree, called (for example – it doesn't matter) “commo”.

Clone the 2 repositories into commo, which now has 2 folders: “commotion-android” & “shell-fork”. Something like:

cd commo
git clone https://github.com/opentechinstitute/commotion-android.git
git clone https://github.com/opentechinstitute/shell-fork.git

Now generate native files. The ndk-build step is unnecessary if you've downloaded the prebuilt NDK.

cd commo/commotion-android
git submodule init
git submodule update
make -C external/
ndk-build

Create the workspace

Fire up Eclipse & create a workspace NOT directly in commo.

Tell Eclipse where the NDK lives: @Window → Preferences → Android → NDK@: browse to your NDK folder.

The workspace will have 2 projects. shell-fork is created with @File → New → Project → Java/Create a Java Project from an Ant Buildfile → select shell-fork/build.xml@

There will be some errors due to a missing Junit reference. Manually add the path: hover over error at the import statement & choose “Fix Project Setup”.

commotion-android is created with @File → New → Project → Android Project from Existing Code@. Browse to the commotion-android folder.

There will be some errors, resolved by pointing at the shell-fork project. In the commotion-android project's preferences,

  • @Properties → Java Build Path@: under Project tab Add Shell,
  • @Properties → Project References@: check Shell,
  • @Properties → Android@: check desired Target (e.g. Android 4.1.2, API level 16)

Deploy and Debug

To debug the app on your device, to your device, select the main project (MeshTether, not the dependent Shell project), & run @Debug As → Android Application@

With luck, this will Just Work, & you will be able to view the log, set breakpoints, etc. OTOH, you might encounter difficulty recognizing the device, especially the first time. In that case, the AVD manager might offer you a choice to use or define a virtual device. Or, you might see a dialog describing your device with a lot of question marks. In either case, take a look at the poetically named file

@/etc/udev/rules.d/51-android.rules@

You'll need su privileges to edit it. It has an entry for each Android device vendor to be recognized. You'll need the vendor ID for your device, enumerated here:

http://developer.android.com/tools/device.html#VendorIds

The syntax of the entries in 51-android.rules has at least 2 flavors. Here's one:

SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", MODE="0666"

Here's another:

SUBSYSTEMS=="usb", SYSFS{idVendor}=="0bb4", MODE=="0666"
SUBSYSTEMS=="usb", SYSFS{idVendor}=="22b8", MODE=="0666"