Knopflerfish on Android/Dalvik VM

Thanks to Yuuki at Makewave Japan we got KF up and running on the Android/Dalvik VM platform. Also, full credits to the original work from Karl and Marcel at Luminis who figured out how to use the DexFile API about a year ago.

The images shows the KF http and text consoles running on the Android emulator.

As of revision 2624 in the KF trunk, the necessary code to install and start "dexified" bundles is added to the KF framework. Additionally, fixes have been done to the KF http server (actually, in the jsdk bundle to solve a bug in dalvik) to allow you to run a web server on Android.

The KF ant build system also contains support for adding the necessary classes.dex file to the framework and bundles.

Currently, we do not distribute such a dexified version, but you could build it yourself by downloading the Android SDK and building KF with

> ant -DANDROID_HOME=[path to android sdk installation dir]

you can then launch the framework (after pushing the necessary files to the emulator) using

> adb shell
# cd [kf_dir]
# dalvikvm -classpath framework.jar org.knopflerfish.framework.Main \
-xargs my.xargs



Souvik said...

This article is quite helpful but following the steps I'm getting a successful built of the Knopflerfish using ant with Android SDK. Then pushed the osgi folder to the device.
Moved to the osgi folder and executed

# dalvikvm -classpath framework.jar org.knopflerfish.framework.Main

resulting in an error

## DEBUG: errors - FrameworkErrorEvent bundle #4
## DEBUG: errors - FrameworkErrorEvent throwable:
java.io.IOException: Failed to load dex class 'org.knopflerfish.bundle.component.Activator', java.lang.reflect.InvocationTargetException
at org.knopflerfish.framework.BundleClassLoader$1.get(BundleClassLoader.java:993)
at org.knopflerfish.framework.BundleClassLoader.searchFor(BundleClassLoader.java:892)
at org.knopflerfish.framework.PermissionOps.callSearchFor(PermissionOps.java:202)
at org.knopflerfish.framework.BundleClassLoader.findClass(BundleClassLoader.java:320)
at org.knopflerfish.framework.BundleClassLoader.loadClass(BundleClassLoader.java:454)
at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
at org.knopflerfish.framework.BundleImpl.start0(BundleImpl.java:371)
at org.knopflerfish.framework.PermissionOps.callStart0(PermissionOps.java:215)
at org.knopflerfish.framework.BundleImpl.start(BundleImpl.java:321)
at org.knopflerfish.framework.StartLevelImpl.increaseStartLevel(StartLevelImpl.java:285)
at org.knopflerfish.framework.StartLevelImpl$1.run(StartLevelImpl.java:217)
at org.knopflerfish.framework.StartLevelImpl.run(StartLevelImpl.java:178)
at java.lang.Thread.run(Thread.java:1060)

Please help me in resolving the issue. Am I doing anything wrong?

Ecommerce said...

Its a good blog and i think most of Internet users are likes your information, so please create more blogs like this, because its good benefit for those peoples. thanks for sharing a wonderful information.

Android app developer