OSGI Bundle using Android API is showing "java.lang.RuntimeException: Stub! at android.util.Log.d" -
in eclipse plugin project, trying use android api. showing message on logcat.
in addition adding android.jar
class path, prepared android.jar
bundle follwing this link. did following:
1- writing manifest.txt contains following:
manifest-version: 1.0 created-by: myself bundle-manifestversion: 2 bundle-name: android bundle-description: package android in osgi bundle bundle-version: 4.4.0 bundle-classpath: .,android.jar bundle-symbolicname: android export-package: android.util
2- creating bundle jar file running following command:
jar cvfm android-bundle.jar manifest.txt android.jar
3- have bundle android-bundle.jar
, open in eclipse file-> new -> project...-> plug-in development -> "plug-in existing jar archives"
next, create bundle use android api. below activator class has log message:
package osgi_android_bundle; import org.osgi.framework.bundleactivator; import org.osgi.framework.bundlecontext; import android.util.log; public class activator implements bundleactivator { private static bundlecontext context; static bundlecontext getcontext() { return context; } /* * (non-javadoc) * @see org.osgi.framework.bundleactivator#start(org.osgi.framework.bundlecontext) */ public void start(bundlecontext bundlecontext) throws exception { activator.context = bundlecontext; system.out.println("hello world. osgi_android_bundle!"); log.d("zaid log", "hello world. osgi_android_bundle!!"); } /* * (non-javadoc) * @see org.osgi.framework.bundleactivator#stop(org.osgi.framework.bundlecontext) */ public void stop(bundlecontext bundlecontext) throws exception { activator.context = null; system.out.println("goodbye world. osgi_android_bundle!"); log.d("zaid log", "goodbye world. osgi_android_bundle!!"); } }
and manifest.mf bundle uses android api:
manifest-version: 1.0 bundle-manifestversion: 2 bundle-name: osgi_android_bundle bundle-symbolicname: osgi_android_bundle bundle-version: 1.0.0.qualifier bundle-activator: osgi_android_bundle.activator import-package: org.osgi.framework;version="1.3.0", android.util bundle-requiredexecutionenvironment: javase-1.6
when run bundle, these errors @ line prints message on log.
org.osgi.framework.bundleexception: exception in osgi_android_bundle.activator.start() of bundle osgi_android_bundle. @ org.eclipse.osgi.framework.internal.core.bundlecontextimpl.startactivator(bundlecontextimpl.java:734) @ org.eclipse.osgi.framework.internal.core.bundlecontextimpl.start(bundlecontextimpl.java:683) @ org.eclipse.osgi.framework.internal.core.bundlehost.startworker(bundlehost.java:381) @ org.eclipse.osgi.framework.internal.core.abstractbundle.resume(abstractbundle.java:390) @ org.eclipse.osgi.framework.internal.core.framework.resumebundle(framework.java:1177) @ org.eclipse.osgi.framework.internal.core.startlevelmanager.resumebundles(startlevelmanager.java:559) @ org.eclipse.osgi.framework.internal.core.startlevelmanager.resumebundles(startlevelmanager.java:544) @ org.eclipse.osgi.framework.internal.core.startlevelmanager.incfwsl(startlevelmanager.java:457) @ org.eclipse.osgi.framework.internal.core.startlevelmanager.dosetstartlevel(startlevelmanager.java:243) @ org.eclipse.osgi.framework.internal.core.startlevelmanager.dispatchevent(startlevelmanager.java:438) @ org.eclipse.osgi.framework.internal.core.startlevelmanager.dispatchevent(startlevelmanager.java:1) @ org.eclipse.osgi.framework.eventmgr.eventmanager.dispatchevent(eventmanager.java:230) @ org.eclipse.osgi.framework.eventmgr.eventmanager$eventthread.run(eventmanager.java:340) caused by: java.lang.runtimeexception: stub! @ android.util.log.d(log.java:7) @ osgi_android_bundle.activator.start(activator.java:27) @ org.eclipse.osgi.framework.internal.core.bundlecontextimpl$1.run(bundlecontextimpl.java:711) @ java.security.accesscontroller.doprivileged(native method) @ org.eclipse.osgi.framework.internal.core.bundlecontextimpl.startactivator(bundlecontextimpl.java:702) ... 12 more root exception: java.lang.runtimeexception: stub! @ android.util.log.d(log.java:7) @ osgi_android_bundle.activator.start(activator.java:27) @ org.eclipse.osgi.framework.internal.core.bundlecontextimpl$1.run(bundlecontextimpl.java:711) @ java.security.accesscontroller.doprivileged(native method) @ org.eclipse.osgi.framework.internal.core.bundlecontextimpl.startactivator(bundlecontextimpl.java:702) @ org.eclipse.osgi.framework.internal.core.bundlecontextimpl.start(bundlecontextimpl.java:683) @ org.eclipse.osgi.framework.internal.core.bundlehost.startworker(bundlehost.java:381) @ org.eclipse.osgi.framework.internal.core.abstractbundle.resume(abstractbundle.java:390) @ org.eclipse.osgi.framework.internal.core.framework.resumebundle(framework.java:1177) @ org.eclipse.osgi.framework.internal.core.startlevelmanager.resumebundles(startlevelmanager.java:559) @ org.eclipse.osgi.framework.internal.core.startlevelmanager.resumebundles(startlevelmanager.java:544) @ org.eclipse.osgi.framework.internal.core.startlevelmanager.incfwsl(startlevelmanager.java:457) @ org.eclipse.osgi.framework.internal.core.startlevelmanager.dosetstartlevel(startlevelmanager.java:243) @ org.eclipse.osgi.framework.internal.core.startlevelmanager.dispatchevent(startlevelmanager.java:438) @ org.eclipse.osgi.framework.internal.core.startlevelmanager.dispatchevent(startlevelmanager.java:1) @ org.eclipse.osgi.framework.eventmgr.eventmanager.dispatchevent(eventmanager.java:230) @ org.eclipse.osgi.framework.eventmgr.eventmanager$eventthread.run(eventmanager.java:340) !entry osgi_android_bundle 4 0 2013-08-12 21:34:21.528 !message frameworkevent error !stack 0 org.osgi.framework.bundleexception: exception in osgi_android_bundle.activator.start() of bundle osgi_android_bundle. @ org.eclipse.osgi.framework.internal.core.bundlecontextimpl.startactivator(bundlecontextimpl.java:734) @ org.eclipse.osgi.framework.internal.core.bundlecontextimpl.start(bundlecontextimpl.java:683) @ org.eclipse.osgi.framework.internal.core.bundlehost.startworker(bundlehost.java:381) @ org.eclipse.osgi.framework.internal.core.abstractbundle.resume(abstractbundle.java:390) @ org.eclipse.osgi.framework.internal.core.framework.resumebundle(framework.java:1177) @ org.eclipse.osgi.framework.internal.core.startlevelmanager.setbundlesl(startlevelmanager.java:670) @ org.eclipse.osgi.framework.internal.core.startlevelmanager.dispatchevent(startlevelmanager.java:435) @ org.eclipse.osgi.framework.internal.core.startlevelmanager.dispatchevent(startlevelmanager.java:1) @ org.eclipse.osgi.framework.eventmgr.eventmanager.dispatchevent(eventmanager.java:230) @ org.eclipse.osgi.framework.eventmgr.eventmanager$eventthread.run(eventmanager.java:340) caused by: java.lang.runtimeexception: stub! @ android.util.log.d(log.java:7) @ osgi_android_bundle.activator.start(activator.java:27) @ org.eclipse.osgi.framework.internal.core.bundlecontextimpl$1.run(bundlecontextimpl.java:711) @ java.security.accesscontroller.doprivileged(native method) @ org.eclipse.osgi.framework.internal.core.bundlecontextimpl.startactivator(bundlecontextimpl.java:702) ... 9 more root exception: java.lang.runtimeexception: stub! @ android.util.log.d(log.java:7) @ osgi_android_bundle.activator.start(activator.java:27) @ org.eclipse.osgi.framework.internal.core.bundlecontextimpl$1.run(bundlecontextimpl.java:711) @ java.security.accesscontroller.doprivileged(native method) @ org.eclipse.osgi.framework.internal.core.bundlecontextimpl.startactivator(bundlecontextimpl.java:702) @ org.eclipse.osgi.framework.internal.core.bundlecontextimpl.start(bundlecontextimpl.java:683) @ org.eclipse.osgi.framework.internal.core.bundlehost.startworker(bundlehost.java:381) @ org.eclipse.osgi.framework.internal.core.abstractbundle.resume(abstractbundle.java:390) @ org.eclipse.osgi.framework.internal.core.framework.resumebundle(framework.java:1177) @ org.eclipse.osgi.framework.internal.core.startlevelmanager.setbundlesl(startlevelmanager.java:670) @ org.eclipse.osgi.framework.internal.core.startlevelmanager.dispatchevent(startlevelmanager.java:435) @ org.eclipse.osgi.framework.internal.core.startlevelmanager.dispatchevent(startlevelmanager.java:1) @ org.eclipse.osgi.framework.eventmgr.eventmanager.dispatchevent(eventmanager.java:230) @ org.eclipse.osgi.framework.eventmgr.eventmanager$eventthread.run(eventmanager.java:340)
this copy of android.util.log
appears saying that's it's stub, rather real implementation. created purely compiling against, , not expected used @ runtime.
update: following stackoverflow question appears confirm guess: error java.lang.runtimeexception: stub! in android fitnesse testing
are running on android device or emulator?? seems may running on standard jvm.
Comments
Post a Comment