在android上启动felix-framework-5.2.0

在android上启动felix-framework-5.2.0,android,osgi,apache-felix,Android,Osgi,Apache Felix,我尝试在Android设备上启动elix-framework-5.2.0 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.j

我尝试在
Android
设备上启动
elix-framework-5.2.0
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

还有其他人有这个问题吗?

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

org.osgi.framework.BundleException: Bundle symbolic name and version are not unique
因为您在felix.auto.start属性中包含的一些bundle是不必要的,因为您正在嵌入的框架中已经包含了这些bundle。只要尝试删除冲突的bundle,您就会解决问题

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

... (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一起工作。要解决此问题,请执行以下操作:

  • 输入SCR-jar文件
  • 打开MANIFEST.MF文件
  • 删除整行所需的功能:(&(osgi.ee=JavaSE)(version=1.6))或类似的功能(确切的语法取决于用于生成jar的工具)
  • 使用新的MANIFEST.MF文件更新存档文件
  • 将更新后的归档文件作为SCR包嵌入到OSGi框架中