Hi All
Some time back, we had a discussion about the default compiler version used to
build Felix, and whether this was compatible with the requirements of Android.
I noted that when you dx the bundle jars produced by the regular Felix build,
you get a whole collection of warning of the the form:
$ dx --dex --output=classes.dex org.apache.felix.eventadmin-1.2.2.jar
warning: Ignoring InnerClasses attribute for an anonymous inner class that
doesn't come with an associated EnclosingMethod attribute. (This class was
probably produced by a broken compiler.)
...for example. We debated this, and decided that these were just warning and
not a real problem. However, now that I have a working Felix framework on
Android, I find that when I load and start the EventAdmin bundle, I find that
it fails to start with the following message in the log:
05-04 12:01:26.853: WARN/System.err(4682): org.osgi.framework.BundleException:
Activator start error in bundle org.apache.felix.eventadmin [5].
05-04 12:01:26.853: WARN/System.err(4682): at
org.apache.felix.framework.Felix.activateBundle(Felix.java:1807)
05-04 12:01:26.853: WARN/System.err(4682): at
org.apache.felix.framework.Felix.startBundle(Felix.java:1682)
05-04 12:01:26.853: WARN/System.err(4682): at
org.apache.felix.framework.BundleImpl.start(BundleImpl.java:905)
05-04 12:01:26.853: WARN/System.err(4682): at
org.apache.felix.framework.BundleImpl.start(BundleImpl.java:892)
05-04 12:01:26.853: WARN/System.err(4682): at
com.skifta.android.client.SkiftaService.startOSGi(SkiftaService.java:437)
05-04 12:01:26.853: WARN/System.err(4682): at
com.skifta.android.client.SkiftaService.init(SkiftaService.java:174)
05-04 12:01:26.853: WARN/System.err(4682): at
com.skifta.android.client.SkiftaService.onCreate(SkiftaService.java:166)
05-04 12:01:26.853: WARN/System.err(4682): at
android.app.ActivityThread.handleCreateService(ActivityThread.java:2894)
05-04 12:01:26.853: WARN/System.err(4682): at
android.app.ActivityThread.access$3200(ActivityThread.java:126)
05-04 12:01:26.853: WARN/System.err(4682): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1986)
05-04 12:01:26.853: WARN/System.err(4682): at
android.os.Handler.dispatchMessage(Handler.java:99)
05-04 12:01:26.853: WARN/System.err(4682): at
android.os.Looper.loop(Looper.java:123)
05-04 12:01:26.853: WARN/System.err(4682): at
android.app.ActivityThread.main(ActivityThread.java:4595)
05-04 12:01:26.853: WARN/System.err(4682): at
java.lang.reflect.Method.invokeNative(Native Method)
05-04 12:01:26.853: WARN/System.err(4682): at
java.lang.reflect.Method.invoke(Method.java:521)
05-04 12:01:26.853: WARN/System.err(4682): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
05-04 12:01:26.853: WARN/System.err(4682): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
05-04 12:01:26.853: WARN/System.err(4682): at
dalvik.system.NativeStart.main(Native Method)
05-04 12:01:26.853: WARN/System.err(4682): Caused by:
java.lang.NoClassDefFoundError:
org.apache.felix.eventadmin.impl.handler.BlacklistingHandlerTasks$1
05-04 12:01:26.853: WARN/System.err(4682): at
org.apache.felix.eventadmin.impl.handler.BlacklistingHandlerTasks.<init>(BlacklistingHandlerTasks.java:223)
05-04 12:01:26.853: WARN/System.err(4682): at
org.apache.felix.eventadmin.impl.Configuration.start(Configuration.java:293)
05-04 12:01:26.853: WARN/System.err(4682): at
org.apache.felix.eventadmin.impl.Configuration.<init>(Configuration.java:152)
05-04 12:01:26.853: WARN/System.err(4682): at
org.apache.felix.eventadmin.impl.Activator.start(Activator.java:65)
05-04 12:01:26.853: WARN/System.err(4682): at
org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:661)
05-04 12:01:26.853: WARN/System.err(4682): at
org.apache.felix.framework.Felix.activateBundle(Felix.java:1760)
05-04 12:01:26.853: WARN/System.err(4682): ... 17 more
Looking at the class in question (BlacklistingHandlerTasks:223) I see that this
is a use of an anonymous inner class:
private final EventHandler m_nullEventHandler = new EventHandler()
{
/**
* This is a null object that is supposed to do nothing at this point.
*
* @param event an event that is not used
*/
public void handleEvent(final Event event)
{
// This is a null object that is supposed to do nothing at this
// point. This is used once a EventHandler is requested for a
// servicereference that is either stale (i.e., unregistered) or
// blacklisted.
}
};
Is this an example of the problem we were discussing a couple of weeks ago,
where dx can’t produce correct copde because the compiler version that was used
to create the bundle was pre-1.5 do you think?
Thanks
Bruce