我是 OSGi 的新手。我在 Android 上运行 Apache Felix。我已将系统包导出的系统包设置如下:
/** Packages exported by the system bundle. */
String SYSTEM_PACKAGES =
"org.osgi.framework;version=\"1.6.0\"," +
"org.osgi.framework.launch;version=\"1.0.0\"," +
"org.osgi.framework.wiring;version=\"1.0.0\"," +
"org.osgi.framework.startlevel;version=\"1.0.0\"," +
"org.osgi.framework.hooks.bundle;version=\"1.0.0\"," +
"org.osgi.framework.hooks.resolver;version=\"1.0.0\"," +
"org.osgi.framework.hooks.service;version=\"1.1.0\"," +
"org.osgi.framework.hooks.weaving;version=\"1.0.0\"," +
"org.osgi.service.packageadmin;version=\"1.2.0\"," +
"org.osgi.service.startlevel;version=\"1.1.0\"," +
"org.osgi.service.url;version=\"1.0.0\"," +
"org.osgi.util.tracker;version=\"1.5.0\"";
Map map = new HashMap();
map.put ( "org.osgi.framework.system.packages" , SYSTEM_PACKAGES );
// I set more properties ...
felix = new Felix ( map );
felix.start();
但是,当我尝试安装 ConfigAdmin 包时,它给出了 BundleException:
org.osgi.framework.BundleException: Unresolved constraint in bundle
org.apache.felix.configadmin [1]: Unable to resolve 1.0: missing requirement [1.0]
osgi.wiring.package; (&(osgi.wiring.package=org.osgi.framework)(version>=1.4.0)
(!(version>=2.0.0)))
当我从版本 1.6.0 的系统包中导出 org.osgi.framework 包时,为什么缺少此要求?我通过执行以下操作检查了系统属性是否正确设置:
// DEBUG
Toast.makeText ( getApplicationContext() ,
felix.getBundleContext().getProperty ( "org.osgi.framework.system.packages" ) ,
Toast.LENGTH_LONG ).show();
可能这是我的一个简单错误。有人可以帮帮我吗?
谢谢!