|
Page Edited :
FELIX :
Apache Felix and Google Android
Apache Felix and Google Android has been edited by Richard S. Hall (Mar 09, 2008). Content:Apache Felix and Google AndroidThe purpose of this document is to explain how to use Apache Felix on Google's new mobile phone platform - Android Dalvik VMGoogle Android SDK allows developers to write Java code in order to create Android applications. Instead of a regular Java Virtual Machine that executes this code, a special-purpose virtual machine named Dalvik is being used in order to comply with mobile platform requirements. Dalvik does not use Java bytecode format, but, a tool named dx, included in the Android SDK, transforms the Java class files of Java classes compiled by a regular Java compiler into another class file format (the .dex format) (the conversion is not done at runtime). Preparing bundlesAlthough latest version of Felix, 1.0.3, has now built in support for Android, there are still some things needed to be done in order to successfully make use of it ( you will need to install Android SDK and you should have <android_SDK_HOME>/tools added to system PATH variable). The zip file available for download has been created in the same manner.
a) create DEX file for your JAR dx --dex --output=classes.dex JAR_file.jar b) add DEX file into the JAR aapt add JAR_file.jar classes.dex
emulator &
osgi-android: / - bin - bundle - conf - felix.sh a) prepare felix JAR export PATH=<path-to-android>/tools:$PATH b) prepare bundle JARS cd bundle c) transfer them all to the emulator (Please note that you need some kind of unix-ish shell (Mac OS X works fine, linux should too) or translate the instructions to your own platform.) cd osgi-android Launching FelixOnce you've done that, you should be able to launch Felix and referred bundles on Android: start emulator shell, change directory to the location of your Felix files and execute felix.sh. adb shell felix.sh contains a unix command that launches Felix main class using the actual runtime of the emulator. /system/bin/dalvikvm -Xbootclasspath:/system/framework/core.jar \ If all went well, you should see the Felix command line shell now. Type "help" for further instructions. You may now install and launch EnglishDictionary , FrenchDictionary and SpellChecker bundles to test how Felix is working. These are all examples from the Apache Felix OSGI tutorial and correspond to Apache Felix Tutorial Example 2, Apache Felix Tutorial Example 2b and Apache Felix Tutorial Example 5 respectively.
start file:bundle/EnglishDictionary.jar Embedding FelixApache Felix can also be integrated with an Android application. DownloadThe project zip file osgi-android.zip |
Unsubscribe or edit your notifications preferences
