Greenstone3 Runtime on Android (NEWER README FILE) ============================== This extension helps you set up and run Greenstone3 on your android device. It relies on the environment variable ANDROID_SDK_HOME to determine where the Android SDK lives on your file system, in a similar way JAVA_HOME gets used by many programs to determin where Java is installed on a particular computer. The key programs we need to run from the Android SDK are 'adb' and 'dex'. The most straight forward way to control this variable is to: cp setup-android.bash.in setup-android.bash and then edit 'setup-android.bash' the value of **ANDROID-SDK-HOME** to be the top-level directory of where the Android SDK was installed to. Having done this, source the main setup file: source setup.bash which automatically sources setup-android.bash if the ANDROID_SDK_HOME environment variable isn't set. Having sourced the setup file the two main steps are: 1) Install i-greenstone-server on the Android device (in order to do this you must checkout on SVN the extension "i-greenstone-server", which has its own seperate README.txt in order to build the application) 2) Install Greenstone3 as a web-app application for i-greenstone-server, for your Android device. Step 1 -------- First, install i-greenstone-server on your Android device. You can do this by typing in your terminal: adb install i-jetty-3.1-aligned.apk Note: for your Android device to install applications using 'adb' you need to have enabled it's application 'Development' mode (under Settings->Application) ************* **Important** ************* Having installed i-greenstone-server, find the application on the Android device and launch it (but you don't have to go as far as starting the i-greenstone server from within this application). Launching i-greenstone-server completes the installation of the application by creating the 'greenstone' folder on the Android's SD-card, and populating it with the default configuration files for i-greenstone-server. The 'jetty' folder is needed for your setup procedure as it is where Greenstone-3 will be installed to. Step 2 -------- (This usually only needs to be done once.) Transfer the bulk of the /web structure to the preparation area "webapps" with the extension foler (i.e., where you are running these scripts from) with: ./PREPARE-WEBAPPS-GREENSTONE-ROOT-FOR-IJETTY.sh This script skips any .svn files if present. It also skips installing the majority of 'localsite' as this can be rather large -- both in size and in terms of the number of files invovled -- so copying is rather slow, and it is probably not what you want anyway. Only the 'lucene-jdbm-demo' collection is copied to the preparation area. Any other collections you wish to add should be manually added to the "webapps/greenstone3/sites/localsite/collect/" area. Step 3 -------- Convert the class files (includes those stored in jar files) into classs.dex with: ./JAVA-TO-DEX.sh The finished file, which is also by this point zipped up, is stored in the 'lib' folder (should you wish to inspect it). It is also automatically copied to "webapps/greenstone3/WEB-INF/lib" which is where it needs to be to work when installed on the Android device. Step 4 -------- Right now we have a fresh new "webapps/greenstone3/" that we've created. Now there's two things you can do - you can either create a JAR file out of this webapps/greenstone3 (which is Step 4A), **OR** You can directly push the webapp into the greenstone/webapps directory on the SD card of your Android phone (which is Step 4B). (Note: You'd probably only want to do Step 4A if you were also working with the source code for i-greenstone-server.) Step 4A -------- Assuming you have Java's bin folder already on your classpath, then run the script: ./CREATE-WAR.sh The result of this script is a newly created "webapps_greenstone.war", which you would put in the /ext/i-greenstone-server/CUSTOMIZATION/assets folder. That way, when it comes to compiling a fresh new i-greenstone-server, it will come pre-bundled with the jar file. **OR** Step 4B -------- Copy Greenstone3's webapps folder onto the Android device's sd-card: ./IJETTY-PUSH.sh webapps/greenstone3 This is the final step in getting Greenstone3 setup on an Andoird. Switch off the USB disk mode on the Android device. Note: it can take a device minute or two "preparing" the sd-card. This can be seen on the notification view. Alternatively, if you try to start i-greenstone-server before the card is ready, then i-greenstone-server points this out, and offers you a 'retry' button. Launch i-greenstone-server from my apps area. Then, within i-greenstone-server, start the server. Once the "Jetty started" message appears, switch to your web-browser application. We've tested the built-in web browser, and Mobile Firefox 4. By default, the URL you would navigate to is: http://localhost:8080/ As of this time of writing (10th January 2013), when you access the Greenstone3 page (i.e. http://localhost:8080/greenstone3) you want to access the "basic servlet", which is the 3rd link from the top. ==== If the compiled Java code to Greenstone3 has changed, then you need to repeat sub-steps 2.2 and 2.3. Transfering just the newly dexified code can be achieved more quickly by entering: ./IJETTY-PUSH.sh webapps/greenstone3/WEB-INF/lib Caveats: ======== 1. Due to difficulties in getting MG and MGPP working on android through the NDK, these are currently not supported. Effectively, the Greenstone3 used needs to be one compiled *without* JNI support. 2. Due to a runtime (reflection) error, we had to modify xalan.jar. The modified version of this file is also in the 'modified-jars' folder used in this extension. 3. This Greenstone3 web app has failed to work on some phones. Upon accessing an individual article in the "basic servlet" (i.e. http://localhost:8080/greenstone3/basic-library) we get a stack overflow error. This has not happened on newer Android phones, leading us to believe that this web app may only work on Android 4.0+ OS, or on newer hardware.