kevin wrote: > I am working on couple android applications which share a common > component. The component has Activities, Service and own > AndroidManifest.xml. After research, it seems there is no concept of > run time share library among applications in Android. So I am looking > for a way to linked the share component with other applications at > compile time. > > Applications which will use the component can come from external, > therefore I will only provided the compiled file. I would like to > build the component into own apk or jar file, can external application > include my jar/apk file into their package and be able to start my > activity?
JAR, yes. It is possible to build Android-aware JARs, containing only classes compiled against the Android SDK JAR. Those Android-aware JARs can define activities, services, etc. Those Android-aware JARs can, in turn, be put in the libs/ directory of an Android APK project and be compiled in. A couple of limits: -- You cannot define resources in Android-aware JARs, because resources are packaged in APKs, not JARs. To compensate, refactor your API to accept resource IDs as parameters, so the calling application can supply you with resource IDs to use. -- You cannot declare a manifest in Android-aware JARs, because the manifest is packaged in the APK. This means your calling application will need to declare any JAR-provided activities, services, etc. on your behalf. My book-in-progress _The Busy Coder's Guide to *Advanced* Android Development_ has a section on this technique. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.0 Published! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

