Android and OSGi: Can they Work Together?
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Android and OSGi: Can they Work Together?

on

  • 3,980 views

 

Statistics

Views

Total Views
3,980
Views on SlideShare
3,722
Embed Views
258

Actions

Likes
5
Downloads
88
Comments
0

22 Embeds 258

http://issamux.blogspot.com 93
http://issamux.blogspot.fr 89
http://issamux.blogspot.kr 21
http://www.slideshare.net 11
https://twitter.com 8
http://issamux.blogspot.ru 7
http://issamux.blogspot.de 6
http://issamux.blogspot.in 4
http://issamux.blogspot.cz 3
http://issamux.blogspot.com.es 2
http://feeds.feedburner.com 2
http://issamux.blogspot.co.uk 2
http://issamux.blogspot.nl 1
http://issamux.blogspot.ie 1
http://issamux.blogspot.sg 1
http://issamux.blogspot.gr 1
http://issamux.blogspot.be 1
http://issamux.blogspot.it 1
http://issamux.blogspot.com.br 1
http://www.blogger.com 1
http://paper.li 1
http://issamux.blogspot.ro 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Android and OSGi: Can they Work Together? Presentation Transcript

  • 1. Android and OSGi: Can they Work Together? BJ Hargrave Senior Technical Staff Member, IBM Lotus Neil Bartlett Java Developer and Consultant Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 2. Yes! Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 3. Any Questions? Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 4. Motivation Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 5. Different Models JVM DVM DVM App App App App App App DVM OSGi Android Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 6. Benefits of OSGi Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 7. Invoke App App Cheap Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 8. App App lib lib lib lib Possible Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 9. Benefits of Android Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 10. App App Safe Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 11. App App Safe Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 12. Finding the right granularity Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 13. Prior work Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 14. Felix on Android Marcel Offermans Karl Pauls (Luminis) (Luminis) Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 15. http://blog.luminis.nl/luminis/entry/ osgi_on_google_android_using (repeated on last slide) Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 16. Our Goal Concierge Equinox Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 17. 1. Concierge Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 18. First step: Start Framework Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 19. “Dexification” Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 20. dx --dex --output=classes.dex foo.jar aapt add foo.jar classes.dex Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 21. Code changes Required Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 22. Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 23. Next Step: Adding a Bundle Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 24. ClassLoader.defineClass() does not work Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 25. Use android.dalvik.DexFile Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 26. private final DexFile df; DexHelper(File file) throws Exception { df = new DexFile(file); } Class defineClass(ClassLoader cl, String name) { String dexName = name.replace('.', '/'); try { Class c = df.loadClass(dexName, cl); return c; } catch (Exception e) { // log error return null; } } Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 27. Patch Limitations Simple bundle classpath only, i.e. Bundle-ClassPath: . No nested JARs No directory bundles Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 28. Android doesn’t like this: ClassLoader.loadClass(clazz, true) ‘true’ triggers ClassLoader.resolveClass(), which fails => call ClassLoader.loadClass(clazz) ‘false’ is the default Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 29. Success! Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 30. DEMO Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 31. 2. Equinox Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 32. First Step: Start Framework Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 33. Somewhat Harder Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 34. Equinox uses CodeSource to configure some properties On Android, ProtectionDomain is null so no CodeSource => Supply properties explicitly Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 35. -Dosgi.framework=file:/data/equinox org.eclipse.osgi_3.4.0.jar -Dosgi.install.area=file:/data/equinox Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 36. ClassLoader.getResource() is used to return list of Hook configuration property files Android always return an empty enum => Manually list hooks in config.ini Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 37. osgi.hook.configurators=org.eclipse.osgi. internal.baseadaptor.BaseHookConfigurator ,org.eclipse.core.runtime.internal.adapto r.EclipseLogHook,org.eclipse.core.runtime .internal.adaptor.EclipseLazyStarter,org. eclipse.core.runtime.internal.adaptor.Ecl ipseStorageHook Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 38. Strange VerifyError on a framework internal class => Turn off the verifier Is this a dexifier bug? Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 39. Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 40. Next Step: Adding a Bundle Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 41. Same need for DexHelper Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 42. Same Limitations Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 43. boot ?? ext app Framework java.* bundle bundle bundle Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 44. boot dummy ext app Framework java.* bundle bundle bundle Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 45. Cannot find java.lang.Object! Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 46. -Dosgi.parentClassloader=ext Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 47. boot ext app Framework java.* bundle bundle bundle Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 48. Success! Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 49. DEMO Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 50. Possible Next Steps A proper hook for dex file loading Full Bundle-ClassPath support JIT dexification of JARs in the hook? Equinox incubator? Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 51. Getting Started All changes available as patches against Concierge, Equinox Subversion repository: http://www.osgi.org/svn/public/trunk/eclipsecon/2008/ androidosgi Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 52. ProSyst http://www.adon-line.de/kunden/prosystBlog/?p=24 Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 53. Links Felix on Android http://blog.luminis.nl/luminis/entry/osgi_on_google_android_using Our Repository: http://www.osgi.org/svn/public/trunk/eclipsecon/2008/androidosgi ProSyst Announcement: http://www.adon-line.de/kunden/prosystBlog/?p=24 Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
  • 54. Legal Notices • IBM and the IBM logo are trademarks or registered trademarks of IBM Corporation, in the United States, other countries or both. • Java and all Java-based marks, among others, are trademarks or registered trademarks of Sun Microsystems in the United States, other countries or both. • Eclipse and the Eclipse logo are trademarks of Eclipse Foundation, Inc. • Other company, product and service names may be trademarks or service marks of others. • THE INFORMATION DISCUSSED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY. WHILE EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION, IT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, AND IBM SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF THE USE OF, OR OTHERWISE RELATED TO, SUCH INFORMATION. ANY INFORMATION CONCERNING IBM'S PRODUCT PLANS OR STRATEGY IS SUBJECT TO CHANGE BY IBM WITHOUT NOTICE. Android and OSGi | Copyright © Neil Bartlett and IBM Corp., 2007-2008. All rights reserved. Source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.