felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "M. van Ree" <mauricevan...@gmail.com>
Subject Re: Problem when exporting system packages from Android to bundles
Date Tue, 03 Apr 2012 09:23:59 GMT
Hey Angelo,

For the moment I've only just used BNDTools to generate the manifest which
seems to work well now, the class mismatch error is gone now.
However, I do get a Nullpointer when trying to draw something on the screen
using the imported packages. But I guess that occurs because the bundle
probably can't use the application context just like that by passing it
along.

Thanks for your answers, certainly helped me fix a rather annoying thing,
wish I had used BNDTools earlier on...

Maurice


On Mon, Apr 2, 2012 at 12:04 PM, Angelo van der Sijpt <
angelo.vandersijpt@luminis.eu> wrote:

> Hi Maurice,
>
> See inline.
>
> On Apr 2, 2012, at 11:51 AM, M. van Ree wrote:
>
> > I was considering the use of BNDTools indeed, and will look into that for
> > sure now.
> > I didn't know about the Bundle-ManifestVersion, will look into that too!
> > The comma is indeed a copy-paste error, as you can see in the bottom
> import
> > statement, I closed the last one without a comma. But, sharp to notice!
>
> Well, it's important to have a good view of what actually is going on in
> your code (it could be a simple typo).
>
> >
> > As far as tools go, I'm just using Eclipse Indigo and the latest Android
> > SDK, dexing and packaging jars with the tools (dx and aapt) from the SDK.
> > When opening the bundle jarfile, the API isn't in there, I don't know
> what
> > happens after installing and starting the bundle on Felix though...I can
> > actually install a bundle and print something to the console or use Log.d
> > to show a message in Logcat, so the bundle (without using Android
> > libraries) does seem to be packaged in the right way I guess?
>
> You can use dexdump to inspect the (dalvik-)contents of a bundle.
>
> >
> > I'll report back here how things work out after trying BNDTools.
>
> Good luck!
>
> >
> > Maurice
>
> Angelo
>
> >
> > On Mon, Apr 2, 2012 at 11:18 AM, Angelo van der Sijpt <
> > angelo.vandersijpt@luminis.eu> wrote:
> >
> >> Right.
> >>
> >> I'm not entirely sure what's up, but some things come to mind,
> >> - in stead of building the manifest by hand, you should consider using
> >> something like BND (perhaps with BNDTools, if you're an Eclipse user) to
> >> handle that for you. If you don't need to use DynamicImport, stick with
> >> 'regular' imports: that way, the framework can inform you better about
> >> what's wrong.
> >> - your bundle should have a "Bundle-ManifestVersion: 2" to state that it
> >> is an R4 bundle (again, BND will do that for you).
> >> - your Import-Package statement seems to have a comma after
> >> org.osgi.framework . I'm not sure whether that is a copy-paste error, or
> >> whether it is actually relevant. (<insert-bnd-notice/>)
> >> - what tools do you use for building your project? Is it possible that
> the
> >> Android API ends up _inside_ your bundle?
> >>
> >> Angelo
> >>
> >> On Apr 2, 2012, at 10:59 AM, M. van Ree wrote:
> >>
> >>> Hello Angelo,
> >>>
> >>> Thank you for your fast response!
> >>> Here is some more info:
> >>>
> >>> a:
> >>> public FelixManager(String rootPath)
> >>> {
> >>> this.rootPath = rootPath;
> >>> felixProperties = new FelixProperties(this.rootPath);
> >>>
> >>>       bundlesDir = new File(rootPath+"/felix/bundle");
> >>>       if (!bundlesDir.exists()) {
> >>>        if (!bundlesDir.mkdirs()) {
> >>>        throw new IllegalStateException("Unable to create bundles dir");
> >>>        }
> >>>       }
> >>>       cacheDir = new File(rootPath+"/felix/cache");
> >>>       if (!cacheDir.exists()) {
> >>>        if (!cacheDir.mkdirs()) {
> >>>        throw new IllegalStateException("Unable to create felixcache
> >> dir");
> >>>        }
> >>>       }
> >>>
> >>>       try
> >>>       {
> >>>           felix = new Felix(felixProperties);
> >>>           felix.start();
> >>>       }
> >>>       catch (Exception ex)
> >>>       {
> >>>           ex.printStackTrace();
> >>>       }
> >>> }
> >>>
> >>> The felix properties are defined as following:
> >>>
> >>> private String m_felixAbsolutePath;
> >>> public FelixProperties(String rootpath)
> >>> {
> >>> m_felixAbsolutePath = rootpath;
> >>> put("org.osgi.framework.storage", m_felixAbsolutePath+"/felix/cache");
> >>> put("felix.cache.rootdir",m_felixAbsolutePath+"/felix");
> >>> put("felix.log.level", "4");
> >>> put("felix.startlevel.bundle", "1");
> >>> put("org.osgi.framework.system.packages.extra",
> >>> ANDROID_PACKAGES_FOR_EXPORT);
> >>> }
> >>> private final String ANDROID_PACKAGES_FOR_EXPORT=
> >>> "android; " +
> >>>           "android.app;" +
> >>>           "android.content;" +
> >>>           "android.database;" + etc. etc.
> >>>
> >>> and b:
> >>>
> >>> Manifest-Version: 1.0
> >>> Bundle-Name: drawbundle
> >>> Bundle-Activator: com.osgi.integration.drawbundle.Activator
> >>> Bundle-SymbolicName: com.osgi.integration.drawbundle
> >>> Bundle-Version: 0.0.1
> >>> Import-Package: org.osgi.framework,
> >>> DynamicImport-Package: android.*
> >>>
> >>> I first, to no avail, tried including the Android packages manually in
> >> the
> >>> Import-Package statement, like so:
> >>>
> >>> Import-Package: org.osgi.framework,
> >>> android.view.LayoutInflater,
> >>> android.view.View,
> >>> android.widget.LinearLayout,
> >>> android.app.Activity,
> >>> android.app.TextView
> >>>
> >>> I've also tried including the Android jarfile in another bundle, and
> >>> exporting the packages from there, and then importing that bundle in
> the
> >>> above manifest.
> >>>
> >>> Maurice
> >>>
> >>> On Mon, Apr 2, 2012 at 10:39 AM, Angelo van der Sijpt <
> >>> angelo.vandersijpt@luminis.eu> wrote:
> >>>
> >>>> This could have something to do with the way you instantiate your
> >>>> framework, _or_ with the way your bundle is packaged.
> >>>> Could you post (a) your framework instantiation code, and (b) the
> >> manifest
> >>>> of your bundle?
> >>>>
> >>>> Angelo
> >>>>
> >>>>
> >>>> On Apr 2, 2012, at 10:18 AM, M. van Ree wrote:
> >>>>
> >>>>> Hello all,
> >>>>>
> >>>>> I have a problem when trying to make the Android lib available to
my
> >> OSGi
> >>>>> bundles.
> >>>>> The error I'm getting is:
> >>>>>
> >>>>> 04-02 08:03:00.351: W/dalvikvm(18531): Method mismatch: onDraw in
> >>>>> Lcom/osgi/integration/drawbundle/DrawView; (cl=0x4067bb40) and super
> >>>>> Landroid/view/View; (cl=0x0)
> >>>>> 04-02 08:03:00.391: W/System.err(18531): Caused by:
> >>>> java.lang.LinkageError:
> >>>>> Classes resolve differently in superclass
> >>>>>
> >>>>> Off course I can see the cl=0x0, so that must be the culprit, but
I
> >> have
> >>>> no
> >>>>> idea on how to get it fixed...
> >>>>> I'm exporting the packages as following in a properties class:
> >>>>>
> >>>>> private static final String ANDROID_PACKAGES_FOR_EXPORT =
> >>>>> ("android; " +
> >>>>> "android.app;" +
> >>>>> "android.content;" +
> >>>>> "android.database;" +
> >>>>>                                       etc. etc. );
> >>>>>
> >>>>> I'm really drawing a blank here on what could be wrong, I would
> expect
> >> to
> >>>>> receive an error on exporting/importing something empty that would
> >> point
> >>>> me
> >>>>> in the right direction, but it doesn't seem to be the case.
> >>>>> Who can tell me what I'm doing wrong here?
> >>>>>
> >>>>>
> >>>>> Regards,
> >>>>> Maurice
> >>>>
> >>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >>>> For additional commands, e-mail: users-help@felix.apache.org
> >>>>
> >>>>
> >>>
> >>>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >> For additional commands, e-mail: users-help@felix.apache.org
> >>
> >>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message