在android

时间:2015-09-21 03:35:39

标签: android osgi apache-felix

我尝试在elix-framework-5.2.0设备上启动Android  添加了config.properties标准:

 felix.auto.start.1=\
 file:bundle/org.apache.felix.bundlerepository-2.0.4.jar \
 file:bundle/org.apache.felix.gogo.command-0.14.0.jar \
 file:bundle/org.apache.felix.gogo.shell-0.10.0.jar \
 file:bundle/org.apache.felix.gogo.runtime-0.16.2.jar \
 file:bundle/org.apache.felix.scr-2.0.0.jar \
 file:bundle/org.apache.felix.http.jetty-2.2.0.jar \
 file:bundle/org.apache.felix.http.api-2.3.2.jar \
 file:bundle/org.apache.felix.http.servlet-api-1.1.2.jar \

启动时,Apache Felix会抛出错误:

Problem creating boot delegation class loader: java.lang.reflect.InvocationTarge
tException
Auto-properties install: file:bundle/org.apache.felix.bundlerepository-2.0.4.jar
 (org.osgi.framework.BundleException: Bundle symbolic name and version are not u
nique: org.apache.felix.bundlerepository:2.0.4)
Auto-properties install: file:bundle/org.apache.felix.gogo.command-0.14.0.jar (o
rg.osgi.framework.BundleException: Bundle symbolic name and version are not uniq
ue: org.apache.felix.gogo.command:0.14.0)
Auto-properties install: file:bundle/org.apache.felix.gogo.shell-0.10.0.jar (org
.osgi.framework.BundleException: Bundle symbolic name and version are not unique
: org.apache.felix.gogo.shell:0.10.0)

.........

ERROR: Bundle org.apache.felix.scr [8] Error starting file:/data/felix/bundle/or
g.apache.felix.scr-2.0.0.jar (org.osgi.framework.BundleException: Unable to reso
lve org.apache.felix.scr [8](R 8.0): missing requirement [org.apache.felix.scr [
8](R 8.0)] osgi.ee; (&(osgi.ee=JavaSE)(version=1.6)) Unresolved requirements: [[
org.apache.felix.scr [8](R 8.0)] osgi.ee; (&(osgi.ee=JavaSE)(version=1.6))])
org.osgi.framework.BundleException: Unable to resolve org.apache.felix.scr [8](R
 8.0): missing requirement [org.apache.felix.scr [8](R 8.0)] osgi.ee; (&(osgi.ee
=JavaSE)(version=1.6)) Unresolved requirements: [[org.apache.felix.scr [8](R 8.0
)] osgi.ee; (&(osgi.ee=JavaSE)(version=1.6))]
        at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:411
4)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:2111)
        at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1365)

        at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStart
LevelImpl.java:308)
        at java.lang.Thread.run(Thread.java:1019)
[INFO] Started jetty 6.1.x at port(s) HTTP:8090

其他人有这个问题吗?

1 个答案:

答案 0 :(得分:1)

嗯,这里有两个主要问题。 首先,你获得

org.osgi.framework.BundleException: Bundle symbolic name and version are not unique

因为您在 felix.auto.start 属性中包含的一些Bundles不是必需的,因为已经包含在您嵌入的框架中。只是尝试删除冲突的捆绑包,您将解决问题。

其次,您已获得缺少的需求错误

... (org.osgi.framework.BundleException: Unable to resolve org.apache.felix.scr [8](R 8.0): missing requirement ...

因为存在指定的要求

(&(osgi.ee=JavaSE)(version=1.6))

告诉你需要一个JRE(Java运行时环境)> = 1.6来执行SCR,但当然Android没有提供JRE,因为它适用于DVK或ART。要解决此问题:

  1. 输入SCR jar文件;
  2. 打开其MANIFEST.MF文件;
  3. 删除整行需要能力:(&(osgi.ee = JavaSE)(版本= 1.6))或类似的东西(确切的语法取决于您用来生成罐)
  4. 使用新的MANIFEST.MF文件更新存档;
  5. 使用更新的存档作为SCR Bundle嵌入OSGi框架。