SlideShare a Scribd company logo
Dr Andy Piper | Oracle Corp.
OSGi and Android
- or how to train your
appserver
Disclaimer
• The opinions represented in these
slides are entirely my own not
Oracle’s
• These slides do not represent any
kind of indication of or commitment
to Oracle’s future products or future
product strategy
Me
• Dr Andy Piper, MA, MBA
• Software architect and engineering
manager for Oracle Complex Event
Processing at Oracle
• ex-BEA, WebLogic Server core
architect
• Author “Spring Dynamic Modules in
Action”
Background
• Android supports Java
– But what does this really mean?
• OSGi has been shown to run on
Android
– Equinox on OSGi at EclipseCon ’08
(Bartlett/IBM)
– Felix on OSGi with EZDroid
(Luminis)
– Various commercial offerings
Don’t cross the streams!
• No-one appears to be trying any
full-fat apps on Android (i.e. non-
phone apps)
• What happens if you try something
big – like an application server, say?
• What problems do you run into?
The challenger
• OCEP
– OSGi-based appserver (a bit like Virgo)
– Spring
– Spring DM
– Glassfish JAXB
– Jetty
– Hessian
– JCL
– Commonj
– And much more …
The challenger at the weigh-in
• Default OCEP installation:
– 224 OSGi bundles
– 125 Mb on-disk
– 162 Mb in-memory
• OCEP re-factored to create a minimal set
of bundles
– Straightforward thanks to OSGi
– Supports a helloworld application, but
not much else
– 113 bundles
– 24 Mb on-disk
– 92 Mb in-memory
Android
• Google Phone OS
• Linux-based kernel and utilities
• Applications are written in Java
– Dalvik VM runs applications
•One VM per-application - no JIT! (except
2.2)
– Proprietary bytecode format
•Optimized for small CPU & memory
footprint
•Java bytecode can be translated
– Package profile similar to Java ME
•Many features missing, e.g. JNDI, parts of
javax.xml, JMX and other enterprise
features
•Based on Apache Harmony class libraries
Android & OSGi
• Dalvik does not support dynamic class
definition
– Problem for OSGi, but there are some
workarounds
• Felix (Apache) now works
– Work by Luminis
– EZdroid project based on Apache ACE
• Equinox demonstrated at EclipseCon 08
– Fixes do not work with latest Android
and Equinox
– But can be made to work
• Other commercial offerings available
OCEP on Android
• OCEP re-packaged as dalvik
bytecode jars
• Equinox issues resolved
• Minimal feature-set bundles will all
install on Android emulator (256Mb
RAM, 256Mb flash)
• But there many problems …
Problems with dalvik profile
• Problem is the missing packages in the
dalvik profile
– For instance OCEP relies on Java SE XML
features not present in profile
– Very hard to simulate since some are in
java.*
• In theory this can be worked around by
providing the packages
– Add xerces
– Add Sun 1.2 JNDI impl
– Add mx4j
• But the list is quite large
Developing a dalvik profile
• Easy to test without Android!
– -Dosgi.java.profile allows the
profile of any VM to be limited
•Still does not simulate missing
java.* packages
– We have a Dalvik profile
– If it works on Windows/Linux it
may work on Dalvik
• We have a small footprint profile as
a starting point
Really, really small profile
• JMX gone (no RMI)
• RMI gone (no RMI OP
implementations)
• JNDI gone (no RMI)
• cglib gone (no dynamic class
definition in Dalvik)
• JMS gone
• datasource gone (too many
dependencies)
Even with the small profile
• Missing packages cause problems
– java.rmi
– java.beans (some of; related to awt & swing)
– javax.security.auth
– javax.management
– javax.naming
– javax.annotation
– javax.xml.validation & friends
– java.sql.SQLXML
• javax outages can be fixed through apache
libraries
• java outages more tricky
Start hacking!
• java.rmi
– Engine dependent on Remote & RemoteException
• Package these up, but ideally factor out
dependency
– Config requires java.rmi.dgc
• Package up, but need to factor out
• java.beans
– Particularly problematic. Android includes some
classes
• But not the useful ones (heavily used by Spring)!
– Take harmony impl and hack out awt & swing
references
– Recompile & package up
• Both need to be included on bootclasspath
More hacking
• java.sql.SQLXML
– Can make the dependency dynamic through
Class.forName()
• XML parser problems
– Cannot use Android and xerces together
– Have to completely replace implementation
– Implementation has assumptions about the
ContextClassLoader
•Hack Factory’s to fallback to bundle
classloader (changes submitted to apache)
– Compiled versions contain bad bytecode!
•Recompile
… and more …
• JAXB Problems
– Contains marshalling support for types
that do not exist on Android
•Hack to remove these dependencies
– Issues with classloading (JAXB or
Harmony bug)
•DynamicImport-Package: *
– Dalvik hasn't implemented
Package.getDeclaredAnnotations()
•Get a LinkageError
•Hack JAXB to remove dependency
… and finally
• Dalvik doesn’t like null as a parent classloader
– Hack Spring DM and Equinox to remove
(changes kindly incorporated by Thomas
Watson)
• Bundle.getResources() can return null which is
not the same semantic as
ClassLoader.findResources()
– Hack Spring DM and Equinox to return empty
collection
• Many missing imports when classloading is
more strict
• Logging requires boot delegation for META-
INF.services to work
But it works!
• 12 extra bundles/jars
– 3 vanilla SpringSource EBR
bundles
– 9 custom patched bundles/jars
• A few Android specific hooks in the
product
– Disable JMX
– Disable cglib
But…
• It’s really slow
– The JIT blows up if you try it (not
tried later JITs)
– Java ME JIT is typically 6x faster
than interpreted code
• It’s really hard to debug
– You can attach remotely
– But the emulator blows up a lot
– Did I mention it’s slow?
The good
• If your application runs on OSGi,
refactoring for footprint is relatively
easy
• Equinox profiles makes testing easy
• Linux/Java on a phone makes for a
very low developer barrier to entry
(contrast with other platforms)
• You can run a full-fat application on
Android/Dalvik
• Non-Dalvik offerings (e.g. Java ME)
are in the works
The bad & ugly
• Android class libraries are just
broken
– What were they thinking!
– Need to support some recognized
VM profile or recognized subset
– Standardization is necessary
• Dalvik VM limitations are a
significant hindrance to
development
Questions?
• Contact: andy.piper@oracle.com

More Related Content

What's hot (20)

PPTX
Migrating to Java 11
Arto Santala
 
PPTX
Scala in the Wild
Tomer Gabel
 
PPT
01 java intro
Deepal Shah
 
ODP
Eureka moment
Paul Withers
 
PDF
Scala
popeast
 
PDF
Maven - Taming the Beast
Roberto Cortez
 
PDF
Whats new in Java 9,10,11,12
Rory Preddy
 
PPT
Evolution Of Java
Munish Gupta
 
KEY
Fun with EJB 3.1 and Open EJB
Arun Gupta
 
PDF
Java EE and Google App Engine
Arun Gupta
 
PPTX
Preparing for java 9 modules upload
Ryan Cuprak
 
PPTX
Java basics at Lara Technologies
laratechnologies
 
PPTX
Hybrid Mobile Development with Apache Cordova and
Ryan Cuprak
 
PDF
Scala introduction
zvikapika
 
DOC
Selenium Classroom Training
Srihitha Technologies
 
PPT
Java SE 7 New Features and Enhancements
Fu Cheng
 
PDF
20140228 fp and_performance
shinolajla
 
PDF
Javantura v4 - JVM++ The GraalVM - Martin Toshev
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
PDF
Develop realtime web with Scala and Xitrum
Ngoc Dao
 
PPT
Java1
Lovepreet Kaur
 
Migrating to Java 11
Arto Santala
 
Scala in the Wild
Tomer Gabel
 
01 java intro
Deepal Shah
 
Eureka moment
Paul Withers
 
Scala
popeast
 
Maven - Taming the Beast
Roberto Cortez
 
Whats new in Java 9,10,11,12
Rory Preddy
 
Evolution Of Java
Munish Gupta
 
Fun with EJB 3.1 and Open EJB
Arun Gupta
 
Java EE and Google App Engine
Arun Gupta
 
Preparing for java 9 modules upload
Ryan Cuprak
 
Java basics at Lara Technologies
laratechnologies
 
Hybrid Mobile Development with Apache Cordova and
Ryan Cuprak
 
Scala introduction
zvikapika
 
Selenium Classroom Training
Srihitha Technologies
 
Java SE 7 New Features and Enhancements
Fu Cheng
 
20140228 fp and_performance
shinolajla
 
Javantura v4 - JVM++ The GraalVM - Martin Toshev
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
Develop realtime web with Scala and Xitrum
Ngoc Dao
 

Viewers also liked (9)

PDF
AMA Using Blogging As A Weapon
Tom Williams
 
PDF
OSGi DevCon US 2010 Review
mfrancis
 
PDF
AMA SIG Social Media 11-4-09
Tom Williams
 
PPT
InnoGage Earth Day 2009
Tom Williams
 
PDF
InnoGage KASCAC Presentation
Tom Williams
 
PDF
OSGi Users' Forum UK - OSGi Release 4 v4.2 Spec Overview - Peter Kriens
mfrancis
 
PPTX
Blogs & Content Marketing
Tom Williams
 
PDF
InnoGage EduWeb Conference UGC - Tapping The Power
Tom Williams
 
PDF
The Six Highest Performing B2B Blog Post Formats
Barry Feldman
 
AMA Using Blogging As A Weapon
Tom Williams
 
OSGi DevCon US 2010 Review
mfrancis
 
AMA SIG Social Media 11-4-09
Tom Williams
 
InnoGage Earth Day 2009
Tom Williams
 
InnoGage KASCAC Presentation
Tom Williams
 
OSGi Users' Forum UK - OSGi Release 4 v4.2 Spec Overview - Peter Kriens
mfrancis
 
Blogs & Content Marketing
Tom Williams
 
InnoGage EduWeb Conference UGC - Tapping The Power
Tom Williams
 
The Six Highest Performing B2B Blog Post Formats
Barry Feldman
 
Ad

Similar to OSGi Community Event 2010 - OSGi and Android (20)

PPTX
Android introduction
Rahul Pola
 
PPT
Android General information
Prashant Gosai
 
PPTX
Introduction to Android (before 2015)
Chien-Ming Chou
 
PDF
Android : How Do I Code Thee?
Viswanath J
 
PPT
Ramakri
msramakrishna
 
PDF
How Android is different from other systems – An exploration of the design de...
IndicThreads
 
PPTX
Getting started with android
amitgb
 
PPTX
Android Architecture design programming with java
ssuser471dfb
 
PPTX
Unit 1 to android Introduction to Android.pptx
ssuser471dfb
 
PDF
Android workshop material
Reza Yogaswara
 
PDF
Introduction to android
krishnastudent88
 
PDF
Introduction to Android Programming by Dr.M.Pyingkodi-kongu engineering c...
pyingkodi maran
 
ODP
Jalimo Slides Linuxtag2008
smancke
 
PPT
Android operating system
Dev Savalia
 
PDF
Introduction to Android Programming
Pyingkodi Maran
 
PPTX
Android Development - Session 2
Mohammad Shaker
 
PPTX
Android Development - Session 1
Mohammad Shaker
 
PPTX
Presentation for Android OS
Mukul Cool
 
PPT
An introduction to Android
Rajesh Jambukia
 
PPT
Andriod
Chayan Upadhyay
 
Android introduction
Rahul Pola
 
Android General information
Prashant Gosai
 
Introduction to Android (before 2015)
Chien-Ming Chou
 
Android : How Do I Code Thee?
Viswanath J
 
Ramakri
msramakrishna
 
How Android is different from other systems – An exploration of the design de...
IndicThreads
 
Getting started with android
amitgb
 
Android Architecture design programming with java
ssuser471dfb
 
Unit 1 to android Introduction to Android.pptx
ssuser471dfb
 
Android workshop material
Reza Yogaswara
 
Introduction to android
krishnastudent88
 
Introduction to Android Programming by Dr.M.Pyingkodi-kongu engineering c...
pyingkodi maran
 
Jalimo Slides Linuxtag2008
smancke
 
Android operating system
Dev Savalia
 
Introduction to Android Programming
Pyingkodi Maran
 
Android Development - Session 2
Mohammad Shaker
 
Android Development - Session 1
Mohammad Shaker
 
Presentation for Android OS
Mukul Cool
 
An introduction to Android
Rajesh Jambukia
 
Andriod
Chayan Upadhyay
 
Ad

More from mfrancis (20)

PDF
Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...
mfrancis
 
PDF
OSGi and Java 9+ - BJ Hargrave (IBM)
mfrancis
 
PDF
Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)
mfrancis
 
PDF
OSGi for the data centre - Connecting OSGi to Kubernetes - Frank Lyaruu
mfrancis
 
PDF
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...
mfrancis
 
PDF
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...
mfrancis
 
PDF
A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...
mfrancis
 
PDF
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
mfrancis
 
PDF
Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...
mfrancis
 
PDF
OSGi CDI Integration Specification - Ray Augé (Liferay)
mfrancis
 
PDF
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...
mfrancis
 
PDF
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
mfrancis
 
PDF
It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...
mfrancis
 
PDF
Popular patterns revisited on OSGi - Christian Schneider (Adobe)
mfrancis
 
PDF
Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)
mfrancis
 
PDF
OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)
mfrancis
 
PDF
Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...
mfrancis
 
PDF
MicroProfile, OSGi was meant for this - Ray Auge (Liferay)
mfrancis
 
PDF
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
mfrancis
 
PDF
How to connect your OSGi application - Dirk Fauth (Bosch)
mfrancis
 
Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...
mfrancis
 
OSGi and Java 9+ - BJ Hargrave (IBM)
mfrancis
 
Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)
mfrancis
 
OSGi for the data centre - Connecting OSGi to Kubernetes - Frank Lyaruu
mfrancis
 
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...
mfrancis
 
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...
mfrancis
 
A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...
mfrancis
 
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
mfrancis
 
Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...
mfrancis
 
OSGi CDI Integration Specification - Ray Augé (Liferay)
mfrancis
 
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...
mfrancis
 
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
mfrancis
 
It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...
mfrancis
 
Popular patterns revisited on OSGi - Christian Schneider (Adobe)
mfrancis
 
Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)
mfrancis
 
OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)
mfrancis
 
Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...
mfrancis
 
MicroProfile, OSGi was meant for this - Ray Auge (Liferay)
mfrancis
 
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
mfrancis
 
How to connect your OSGi application - Dirk Fauth (Bosch)
mfrancis
 

Recently uploaded (20)

PDF
introduction to computer hardware and sofeware
chauhanshraddha2007
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
Alpha Altcoin Setup : TIA - 19th July 2025
CIFDAQ
 
PPTX
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PDF
Market Insight : ETH Dominance Returns
CIFDAQ
 
PDF
NewMind AI Weekly Chronicles – July’25, Week III
NewMind AI
 
PPTX
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
PDF
visibel.ai Company Profile – Real-Time AI Solution for CCTV
visibelaiproject
 
PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PDF
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 
PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PPTX
python advanced data structure dictionary with examples python advanced data ...
sprasanna11
 
PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PDF
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PDF
Basics of Electronics for IOT(actuators ,microcontroller etc..)
arnavmanesh
 
introduction to computer hardware and sofeware
chauhanshraddha2007
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
Alpha Altcoin Setup : TIA - 19th July 2025
CIFDAQ
 
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
Market Insight : ETH Dominance Returns
CIFDAQ
 
NewMind AI Weekly Chronicles – July’25, Week III
NewMind AI
 
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
visibel.ai Company Profile – Real-Time AI Solution for CCTV
visibelaiproject
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 
The Future of AI & Machine Learning.pptx
pritsen4700
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
python advanced data structure dictionary with examples python advanced data ...
sprasanna11
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
Basics of Electronics for IOT(actuators ,microcontroller etc..)
arnavmanesh
 

OSGi Community Event 2010 - OSGi and Android

  • 1. Dr Andy Piper | Oracle Corp. OSGi and Android - or how to train your appserver
  • 2. Disclaimer • The opinions represented in these slides are entirely my own not Oracle’s • These slides do not represent any kind of indication of or commitment to Oracle’s future products or future product strategy
  • 3. Me • Dr Andy Piper, MA, MBA • Software architect and engineering manager for Oracle Complex Event Processing at Oracle • ex-BEA, WebLogic Server core architect • Author “Spring Dynamic Modules in Action”
  • 4. Background • Android supports Java – But what does this really mean? • OSGi has been shown to run on Android – Equinox on OSGi at EclipseCon ’08 (Bartlett/IBM) – Felix on OSGi with EZDroid (Luminis) – Various commercial offerings
  • 5. Don’t cross the streams! • No-one appears to be trying any full-fat apps on Android (i.e. non- phone apps) • What happens if you try something big – like an application server, say? • What problems do you run into?
  • 6. The challenger • OCEP – OSGi-based appserver (a bit like Virgo) – Spring – Spring DM – Glassfish JAXB – Jetty – Hessian – JCL – Commonj – And much more …
  • 7. The challenger at the weigh-in • Default OCEP installation: – 224 OSGi bundles – 125 Mb on-disk – 162 Mb in-memory • OCEP re-factored to create a minimal set of bundles – Straightforward thanks to OSGi – Supports a helloworld application, but not much else – 113 bundles – 24 Mb on-disk – 92 Mb in-memory
  • 8. Android • Google Phone OS • Linux-based kernel and utilities • Applications are written in Java – Dalvik VM runs applications •One VM per-application - no JIT! (except 2.2) – Proprietary bytecode format •Optimized for small CPU & memory footprint •Java bytecode can be translated – Package profile similar to Java ME •Many features missing, e.g. JNDI, parts of javax.xml, JMX and other enterprise features •Based on Apache Harmony class libraries
  • 9. Android & OSGi • Dalvik does not support dynamic class definition – Problem for OSGi, but there are some workarounds • Felix (Apache) now works – Work by Luminis – EZdroid project based on Apache ACE • Equinox demonstrated at EclipseCon 08 – Fixes do not work with latest Android and Equinox – But can be made to work • Other commercial offerings available
  • 10. OCEP on Android • OCEP re-packaged as dalvik bytecode jars • Equinox issues resolved • Minimal feature-set bundles will all install on Android emulator (256Mb RAM, 256Mb flash) • But there many problems …
  • 11. Problems with dalvik profile • Problem is the missing packages in the dalvik profile – For instance OCEP relies on Java SE XML features not present in profile – Very hard to simulate since some are in java.* • In theory this can be worked around by providing the packages – Add xerces – Add Sun 1.2 JNDI impl – Add mx4j • But the list is quite large
  • 12. Developing a dalvik profile • Easy to test without Android! – -Dosgi.java.profile allows the profile of any VM to be limited •Still does not simulate missing java.* packages – We have a Dalvik profile – If it works on Windows/Linux it may work on Dalvik • We have a small footprint profile as a starting point
  • 13. Really, really small profile • JMX gone (no RMI) • RMI gone (no RMI OP implementations) • JNDI gone (no RMI) • cglib gone (no dynamic class definition in Dalvik) • JMS gone • datasource gone (too many dependencies)
  • 14. Even with the small profile • Missing packages cause problems – java.rmi – java.beans (some of; related to awt & swing) – javax.security.auth – javax.management – javax.naming – javax.annotation – javax.xml.validation & friends – java.sql.SQLXML • javax outages can be fixed through apache libraries • java outages more tricky
  • 15. Start hacking! • java.rmi – Engine dependent on Remote & RemoteException • Package these up, but ideally factor out dependency – Config requires java.rmi.dgc • Package up, but need to factor out • java.beans – Particularly problematic. Android includes some classes • But not the useful ones (heavily used by Spring)! – Take harmony impl and hack out awt & swing references – Recompile & package up • Both need to be included on bootclasspath
  • 16. More hacking • java.sql.SQLXML – Can make the dependency dynamic through Class.forName() • XML parser problems – Cannot use Android and xerces together – Have to completely replace implementation – Implementation has assumptions about the ContextClassLoader •Hack Factory’s to fallback to bundle classloader (changes submitted to apache) – Compiled versions contain bad bytecode! •Recompile
  • 17. … and more … • JAXB Problems – Contains marshalling support for types that do not exist on Android •Hack to remove these dependencies – Issues with classloading (JAXB or Harmony bug) •DynamicImport-Package: * – Dalvik hasn't implemented Package.getDeclaredAnnotations() •Get a LinkageError •Hack JAXB to remove dependency
  • 18. … and finally • Dalvik doesn’t like null as a parent classloader – Hack Spring DM and Equinox to remove (changes kindly incorporated by Thomas Watson) • Bundle.getResources() can return null which is not the same semantic as ClassLoader.findResources() – Hack Spring DM and Equinox to return empty collection • Many missing imports when classloading is more strict • Logging requires boot delegation for META- INF.services to work
  • 19. But it works! • 12 extra bundles/jars – 3 vanilla SpringSource EBR bundles – 9 custom patched bundles/jars • A few Android specific hooks in the product – Disable JMX – Disable cglib
  • 20. But… • It’s really slow – The JIT blows up if you try it (not tried later JITs) – Java ME JIT is typically 6x faster than interpreted code • It’s really hard to debug – You can attach remotely – But the emulator blows up a lot – Did I mention it’s slow?
  • 21. The good • If your application runs on OSGi, refactoring for footprint is relatively easy • Equinox profiles makes testing easy • Linux/Java on a phone makes for a very low developer barrier to entry (contrast with other platforms) • You can run a full-fat application on Android/Dalvik • Non-Dalvik offerings (e.g. Java ME) are in the works
  • 22. The bad & ugly • Android class libraries are just broken – What were they thinking! – Need to support some recognized VM profile or recognized subset – Standardization is necessary • Dalvik VM limitations are a significant hindrance to development