1

我尝试在 Android 4.+ 上使用 iPOJO 1.11.0 启动 apache-felix 4.2.1。

config.properties 标准添加:

org.osgi.framework.system.packages.extra= \
android, \
android.accessibilityservice, \
...
android.support.v4.view.accessibility, \
android.support.v4.widget

启动命令:

/system/bin/dalvikvm -Xbootclasspath:/system/framework/core.jar -classpath bin/felix.jar org.apache.felix.main.Main

启动后写:

Problem creating boot delegation class loader: java.lang.reflect.InvocationTargetException

1)这个问题我所有的应用程序都可以正常工作,但也许有人知道如何修复这个问题?(然后从osgi-android.zip启动 apache felix - 没有这个问题。)

启动 Apache Felix iPOJO (1.11.0) 时抛出错误:

! ERROR: Bundle org.apache.felix.ipojo [14] Error starting file:/data/local/feli
x/felix-framework-4.2.1a/bundle/org.apache.felix.ipojo-1.11.0.jar (org.osgi.fram
ework.BundleException: Activator start error in bundle org.apache.felix.ipojo [1
4].)
java.lang.NoClassDefFoundError: org.apache.felix.ipojo.util.Logger$ConsoleLogSer
vice
        at org.apache.felix.ipojo.util.Logger.<clinit>(Logger.java:51)
        at org.apache.felix.ipojo.extender.internal.Extender.start(Extender.java
:123)
        at org.apache.felix.framework.util.SecureAction.startActivator(SecureAct
ion.java:645)
        at org.apache.felix.framework.Felix.activateBundle(Felix.java:2146)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:2064)
        at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1291)

        at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStart
LevelImpl.java:304)
        at java.lang.Thread.run(Thread.java:841)

2)如何正确启动org.apache.felix.ipojo-1.11.0.jar?iPOJO 支持 Android 有限制

捆绑:

! lb
START LEVEL 1
   ID|State      |Level|Name
    0|Active     |    0|System Bundle (4.2.1)
    6|Active     |    1|jcl-over-slf4j (1.7.5)
    8|Active     |    1|Logback Classic Module (1.0.13)
    9|Active     |    1|Logback Core Module (1.0.13)
   10|Active     |    1|Apache Felix Bundle Repository (1.6.6)
   11|Active     |    1|Apache Felix Gogo Command (0.12.0)
   12|Active     |    1|Apache Felix Gogo Runtime (0.10.0)
   13|Active     |    1|Apache Felix Gogo Shell (0.10.0)
   14|Resolved   |    1|Apache Felix iPOJO (1.11.0)
   15|Active     |    1|Apache Felix iPOJO API (1.11.0)
   16|Active     |    1|Apache Felix iPOJO Gogo Command (1.11.0)
   17|Active     |    1|Apache Felix Log Service (1.0.1)
   18|Active     |    1|osgi.cmpn (4.2.0.200908310645)
   21|Active     |    1|slf4j-api (1.7.5)

更新:

使用 dex2jar-0.0.9.15 classes.dex->​​classes.jar

classes.jar 包含:

org/
org/apache/
org/apache/felix/
org/apache/felix/ipojo/
org/apache/felix/ipojo/Factory.class
org/apache/felix/ipojo/IPojoFactory.class
org/apache/felix/ipojo/util/
org/apache/felix/ipojo/util/TrackerCustomizer.class
org/apache/felix/ipojo/ComponentFactory.class
org/apache/felix/ipojo/ComponentInstance.class
org/apache/felix/ipojo/ConfigurationException.class
org/osgi/
org/osgi/service/
org/osgi/service/cm/
org/osgi/service/cm/ConfigurationListener.class
org/apache/felix/ipojo/ConfigurationTracker.class
org/apache/felix/ipojo/ConstructorInjector.class
org/apache/felix/ipojo/ContextListener.class
org/apache/felix/ipojo/ContextSource.class
org/apache/felix/ipojo/ErrorHandler.class
org/apache/felix/ipojo/EventDispatcher.class
org/apache/felix/ipojo/FactoryClassloader.class
org/apache/felix/ipojo/FactoryStateListener.class
org/apache/felix/ipojo/FieldInterceptor.class
org/apache/felix/ipojo/Handler.class
org/apache/felix/ipojo/HandlerFactory.class
org/apache/felix/ipojo/InstanceStateListener.class
org/apache/felix/ipojo/InstanceManager.class
org/apache/felix/ipojo/HandlerManager.class
org/apache/felix/ipojo/architecture/
org/apache/felix/ipojo/architecture/ComponentTypeDescription.class
org/apache/felix/ipojo/HandlerManagerFactory$HandlerTypeDescription.class
org/apache/felix/ipojo/HandlerManagerFactory.class
org/apache/felix/ipojo/IPOJOServiceFactory.class
org/apache/felix/ipojo/ServiceContext.class
org/apache/felix/ipojo/IPojoContext.class
org/apache/felix/ipojo/IPojoFactory$NameGenerator.class
org/apache/felix/ipojo/IPojoFactory$DefaultNameGenerator.class
org/apache/felix/ipojo/IPojoFactory$RequiredHandler.class
org/apache/felix/ipojo/IPojoFactory$RetryNameGenerator.class
org/apache/felix/ipojo/MethodInterceptor.class
org/apache/felix/ipojo/MissingHandlerException.class
org/apache/felix/ipojo/Nullable.class
org/apache/felix/ipojo/Pojo.class
org/apache/felix/ipojo/PolicyServiceContext.class
org/apache/felix/ipojo/PrimitiveHandler.class
org/apache/felix/ipojo/architecture/InstanceDescription.class
org/apache/felix/ipojo/PrimitiveInstanceDescription.class
org/apache/felix/ipojo/PrimitiveTypeDescription$InheritanceInspector.class
org/apache/felix/ipojo/PrimitiveTypeDescription.class
org/apache/felix/ipojo/UnacceptableConfiguration.class
org/apache/felix/ipojo/architecture/Architecture.class
org/apache/felix/ipojo/architecture/CustomHandlerInfo.class
org/apache/felix/ipojo/architecture/HandlerDescription.class
org/apache/felix/ipojo/architecture/PropertyDescription.class
org/apache/felix/ipojo/configuration/
org/apache/felix/ipojo/configuration/Configuration.class
org/apache/felix/ipojo/configuration/Instance$FluentList.class
org/apache/felix/ipojo/configuration/Instance$FluentMap.class
org/apache/felix/ipojo/configuration/Instance$Pair.class
org/apache/felix/ipojo/configuration/Instance$Property.class
org/apache/felix/ipojo/configuration/Instance.class
org/apache/felix/ipojo/context/
org/apache/felix/ipojo/context/ServiceReferenceImpl.class
org/apache/felix/ipojo/context/ServiceRegistrationImpl.class
org/apache/felix/ipojo/context/ServiceRegistry$1.class
org/apache/felix/ipojo/context/ServiceRegistry$ListenerInfo.class
org/apache/felix/ipojo/context/ServiceRegistry.class
org/apache/felix/ipojo/context/StringMap$StringComparator.class
org/apache/felix/ipojo/context/StringMap.class
org/apache/felix/ipojo/dependency/
org/apache/felix/ipojo/dependency/interceptors/
org/apache/felix/ipojo/dependency/interceptors/DependencyInterceptor.class
org/apache/felix/ipojo/dependency/interceptors/ServiceRankingInterceptor.class
org/apache/felix/ipojo/dependency/impl/
org/apache/felix/ipojo/dependency/impl/ComparatorBasedServiceRankingInterceptor.
class
org/apache/felix/ipojo/dependency/impl/DependencyProperties.class
org/apache/felix/ipojo/dependency/impl/EmptyBasedServiceRankingInterceptor.class

org/apache/felix/ipojo/dependency/interceptors/ServiceTrackingInterceptor.class
org/apache/felix/ipojo/dependency/impl/FilterBasedServiceTrackingInterceptor.cla
ss
org/apache/felix/ipojo/dependency/impl/ServiceReferenceManager$1.class
org/apache/felix/ipojo/dependency/impl/ServiceReferenceManager$2.class
org/apache/felix/ipojo/dependency/impl/ServiceReferenceManager$3.class
org/apache/felix/ipojo/dependency/impl/ServiceReferenceManager$ChangeSet.class
org/apache/felix/ipojo/dependency/impl/ServiceReferenceManager$RankingResult.cla
ss
org/apache/felix/ipojo/dependency/impl/ServiceReferenceManager.class
org/apache/felix/ipojo/dependency/impl/ServiceReferenceUtils.class
org/apache/felix/ipojo/dependency/interceptors/TransformedServiceReference.class

org/apache/felix/ipojo/dependency/impl/TransformedServiceReferenceImpl.class
org/apache/felix/ipojo/dependency/interceptors/DefaultDependencyInterceptor.clas
s
org/apache/felix/ipojo/dependency/interceptors/DefaultServiceRankingInterceptor.
class
org/apache/felix/ipojo/dependency/interceptors/DefaultServiceTrackingInterceptor
.class
org/apache/felix/ipojo/dependency/interceptors/ServiceBindingInterceptor.class
org/apache/felix/ipojo/extender/
org/apache/felix/ipojo/extender/Declaration.class
org/apache/felix/ipojo/extender/ExtensionDeclaration.class
org/apache/felix/ipojo/extender/InstanceDeclaration.class
org/apache/felix/ipojo/extender/Status.class
org/apache/felix/ipojo/extender/TypeDeclaration.class
org/apache/felix/ipojo/extender/builder/
org/apache/felix/ipojo/extender/builder/FactoryBuilder.class
org/apache/felix/ipojo/extender/builder/FactoryBuilderException.class
org/apache/felix/ipojo/extender/internal/
org/apache/felix/ipojo/extender/internal/Lifecycle.class
org/apache/felix/ipojo/extender/internal/AbstractService.class
org/apache/felix/ipojo/extender/internal/BundleProcessor.class
org/apache/felix/ipojo/extender/queue/
org/apache/felix/ipojo/extender/queue/Job.class
org/apache/felix/ipojo/extender/internal/DefaultJob.class
org/apache/felix/ipojo/extender/internal/Extender$1.class
org/apache/felix/ipojo/extender/internal/Extender.class
org/apache/felix/ipojo/extender/queue/QueueService.class
org/apache/felix/ipojo/extender/internal/LifecycleQueueService.class
org/apache/felix/ipojo/extender/internal/builder/
org/apache/felix/ipojo/extender/internal/builder/ReflectiveFactoryBuilder.class
org/apache/felix/ipojo/extender/internal/declaration/
org/apache/felix/ipojo/extender/internal/declaration/AbstractDeclaration$1.class

org/apache/felix/ipojo/extender/internal/declaration/AbstractDeclaration.class
org/apache/felix/ipojo/extender/internal/declaration/DefaultExtensionDeclaration
.class
org/apache/felix/ipojo/extender/internal/declaration/DefaultInstanceDeclaration.
class
org/apache/felix/ipojo/extender/internal/declaration/DefaultTypeDeclaration.clas
s
org/apache/felix/ipojo/extender/internal/linker/
org/apache/felix/ipojo/extender/internal/linker/DeclarationLinker.class
org/apache/felix/ipojo/extender/internal/linker/ManagedType$1.class
org/apache/felix/ipojo/extender/internal/linker/ManagedType$ExtensionSupport$1.c
lass
org/apache/felix/ipojo/extender/internal/linker/ManagedType$ExtensionSupport.cla
ss
org/apache/felix/ipojo/extender/internal/linker/ManagedType$InstanceSupport$1.cl
ass
org/apache/felix/ipojo/extender/internal/linker/ManagedType$InstanceSupport.clas
s
org/apache/felix/ipojo/extender/internal/linker/ManagedType.class
org/apache/felix/ipojo/extender/internal/processor/
org/apache/felix/ipojo/extender/internal/processor/ChainedBundleProcessor.class
org/apache/felix/ipojo/extender/internal/processor/ComponentsBundleProcessor$1.c
lass
org/apache/felix/ipojo/extender/internal/processor/ComponentsBundleProcessor$Com
ponentsAndInstances.class
org/apache/felix/ipojo/extender/internal/processor/ComponentsBundleProcessor.cla
ss
org/objectweb/
org/objectweb/asm/
org/objectweb/asm/ClassVisitor.class
org/objectweb/asm/FieldVisitor.class
org/objectweb/asm/MethodVisitor.class
org/objectweb/asm/AnnotationVisitor.class
org/objectweb/asm/commons/
org/objectweb/asm/commons/EmptyVisitor.class
org/objectweb/asm/Opcodes.class
org/apache/felix/ipojo/extender/internal/processor/ConfigurationAnnotationScanne
r.class
org/apache/felix/ipojo/extender/internal/processor/ConfigurationProcessor$1.clas
s
org/apache/felix/ipojo/extender/internal/processor/ConfigurationProcessor$Compon
entsAndInstances.class
org/apache/felix/ipojo/extender/internal/processor/ConfigurationProcessor.class
org/apache/felix/ipojo/extender/internal/processor/ExtensionBundleProcessor.clas
s
org/apache/felix/ipojo/extender/internal/processor/ForwardingBundleProcessor.cla
ss
org/apache/felix/ipojo/extender/internal/processor/QueuingActivationProcessor$1.
class
org/apache/felix/ipojo/extender/internal/processor/QueuingActivationProcessor.cl
ass
org/apache/felix/ipojo/extender/internal/processor/ReverseBundleProcessor.class
org/apache/felix/ipojo/extender/internal/queue/
org/apache/felix/ipojo/extender/internal/queue/QueueNotifier.class
org/apache/felix/ipojo/extender/internal/queue/AbstractQueueService.class
org/osgi/service/cm/ManagedService.class
org/apache/felix/ipojo/extender/internal/queue/ExecutorQueueService.class
org/apache/felix/ipojo/extender/internal/queue/GroupThreadFactory.class
org/apache/felix/ipojo/extender/queue/JobInfo.class
org/apache/felix/ipojo/extender/internal/queue/JobInfoCallable.class
org/apache/felix/ipojo/extender/internal/queue/NamingThreadFactory.class
org/apache/felix/ipojo/extender/internal/queue/PrefixedThreadFactory.class
org/apache/felix/ipojo/extender/internal/queue/Statistic.class
org/apache/felix/ipojo/extender/internal/queue/SynchronousQueueService$Immediate
Future.class
org/apache/felix/ipojo/extender/internal/queue/SynchronousQueueService$Exception
Future.class
org/apache/felix/ipojo/extender/internal/queue/SynchronousQueueService.class
org/apache/felix/ipojo/extender/internal/queue/debug/
org/apache/felix/ipojo/extender/internal/queue/debug/ReplayQueueEventProxy$Queue
Event.class
org/apache/felix/ipojo/extender/internal/queue/debug/ReplayQueueEventProxy$Enlis
tedQueueEvent.class
org/apache/felix/ipojo/extender/internal/queue/debug/ReplayQueueEventProxy$Execu
tedQueueEvent.class
org/apache/felix/ipojo/extender/internal/queue/debug/ReplayQueueEventProxy$Faile
dQueueEvent.class
org/apache/felix/ipojo/extender/internal/queue/debug/ReplayQueueEventProxy$Start
edQueueEvent.class
org/apache/felix/ipojo/extender/queue/debug/
org/apache/felix/ipojo/extender/queue/debug/QueueEventProxy.class
org/apache/felix/ipojo/extender/queue/QueueListener.class
org/apache/felix/ipojo/extender/internal/queue/debug/ReplayQueueEventProxy.class

org/apache/felix/ipojo/extender/internal/queue/pref/
org/apache/felix/ipojo/extender/internal/queue/pref/PreferenceSelection.class
org/apache/felix/ipojo/extender/internal/queue/pref/HeaderPreferenceSelection.cl
ass
org/apache/felix/ipojo/extender/internal/queue/pref/Preference.class
org/apache/felix/ipojo/extender/internal/queue/pref/PreferenceQueueService$1.cla
ss
org/apache/felix/ipojo/extender/internal/queue/pref/PreferenceQueueService.class

org/apache/felix/ipojo/extender/internal/queue/pref/enforce/
org/apache/felix/ipojo/extender/internal/queue/pref/enforce/ForwardingQueueServi
ce.class
org/apache/felix/ipojo/extender/internal/queue/pref/enforce/EnforcedQueueService
.class
org/apache/felix/ipojo/extender/queue/Callback.class
org/apache/felix/ipojo/handlers/
org/apache/felix/ipojo/handlers/architecture/
org/apache/felix/ipojo/handlers/architecture/ArchitectureHandler.class
org/apache/felix/ipojo/handlers/configuration/
org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.class
org/apache/felix/ipojo/handlers/configuration/ConfigurationHandlerDescription.cl
ass
org/apache/felix/ipojo/handlers/configuration/ConfigurationListener.class
org/apache/felix/ipojo/handlers/dependency/
org/apache/felix/ipojo/handlers/dependency/AggregateDependencyInjectionType.clas
s
org/apache/felix/ipojo/handlers/dependency/Dependency$1.class
org/apache/felix/ipojo/handlers/dependency/Dependency$DynamicProxyFactory.class
org/apache/felix/ipojo/handlers/dependency/Dependency$NullableClassLoader.class
org/apache/felix/ipojo/handlers/dependency/Dependency$SmartProxyFactory.class
org/apache/felix/ipojo/util/DependencyModel.class
org/apache/felix/ipojo/handlers/dependency/Dependency.class
org/apache/felix/ipojo/util/Callback.class
org/apache/felix/ipojo/handlers/dependency/DependencyCallback.class
org/apache/felix/ipojo/handlers/dependency/DependencyConfigurationChecker.class
org/apache/felix/ipojo/handlers/dependency/DependencyDescription.class
org/apache/felix/ipojo/util/DependencyStateListener.class
org/apache/felix/ipojo/handlers/dependency/DependencyHandler.class
org/apache/felix/ipojo/handlers/dependency/DependencyHandlerDescription.class
org/apache/felix/ipojo/handlers/dependency/NullableObject.class
org/apache/felix/ipojo/handlers/dependency/ProxyGenerator.class
org/apache/felix/ipojo/handlers/dependency/ServiceCollection$1.class
org/apache/felix/ipojo/handlers/dependency/ServiceCollection$ServiceIterator.cla
ss
org/apache/felix/ipojo/handlers/dependency/ServiceCollection.class
org/apache/felix/ipojo/handlers/dependency/ServiceUsage$Usage.class
org/apache/felix/ipojo/handlers/dependency/ServiceUsage.class
org/apache/felix/ipojo/handlers/lifecycle/
org/apache/felix/ipojo/handlers/lifecycle/callback/
org/apache/felix/ipojo/handlers/lifecycle/callback/LifecycleCallback.class
org/apache/felix/ipojo/handlers/lifecycle/callback/LifecycleCallbackHandler.clas
s
org/apache/felix/ipojo/handlers/lifecycle/controller/
org/apache/felix/ipojo/handlers/lifecycle/controller/ControllerHandler.class
org/apache/felix/ipojo/handlers/providedservice/
org/apache/felix/ipojo/handlers/providedservice/CreationStrategy.class
org/apache/felix/ipojo/handlers/providedservice/ProvidedService$1.class
org/apache/felix/ipojo/handlers/providedservice/ProvidedService$FactoryStrategy.
class
org/apache/felix/ipojo/handlers/providedservice/ProvidedService$PerInstanceStrat
egy.class
org/apache/felix/ipojo/handlers/providedservice/ProvidedService$ServiceControlle
r.class
org/apache/felix/ipojo/handlers/providedservice/ProvidedService$SingletonStrateg
y.class
org/apache/felix/ipojo/handlers/providedservice/ProvidedService.class
org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceDescription.class

org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.class
org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandlerDescriptio
n.class
org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceListener.class
org/apache/felix/ipojo/handlers/providedservice/strategy/
org/apache/felix/ipojo/handlers/providedservice/strategy/ConfigurableCreationStr
ategy.class
org/apache/felix/ipojo/handlers/providedservice/strategy/ErrorPrintingServiceFac
toryProxy.class
org/apache/felix/ipojo/handlers/providedservice/strategy/ServiceObjectFactory.cl
ass
org/apache/felix/ipojo/metadata/
org/apache/felix/ipojo/metadata/Attribute.class
org/apache/felix/ipojo/metadata/Element.class
org/apache/felix/ipojo/parser/
org/apache/felix/ipojo/parser/FieldMetadata.class
org/apache/felix/ipojo/parser/ManifestMetadataParser.class
org/apache/felix/ipojo/parser/MethodMetadata.class
org/apache/felix/ipojo/parser/ParseException.class
org/apache/felix/ipojo/parser/ParseUtils.class
org/apache/felix/ipojo/parser/PojoMetadata.class
org/apache/felix/ipojo/util/ContextSourceManager$1.class
org/apache/felix/ipojo/util/ContextSourceManager$SourceTracker.class
org/apache/felix/ipojo/util/ContextSourceManager.class
org/apache/felix/ipojo/util/DependencyMetadataHelper.class
org/apache/felix/ipojo/util/DependencyModel$1.class
org/apache/felix/ipojo/util/DependencyModel$DependencyEventType.class
org/apache/felix/ipojo/util/DependencyModel$ServiceBindingHolder.class
org/apache/felix/ipojo/util/DependencyModelListener.class
org/apache/felix/ipojo/util/Fields.class
org/apache/felix/ipojo/util/InstanceConfigurationSource.class
org/apache/felix/ipojo/util/InvocationResult.class
org/apache/felix/ipojo/util/Log.class
org/apache/felix/ipojo/util/Logger$1.class
org/osgi/service/log/
org/osgi/service/log/LogService.class
org/apache/felix/ipojo/util/Logger$ConsoleLogService.class
org/apache/felix/ipojo/util/Logger.class
org/apache/felix/ipojo/util/Methods.class
org/apache/felix/ipojo/util/Property.class
org/apache/felix/ipojo/util/Reflection.class
org/apache/felix/ipojo/util/SecurityHelper.class
org/apache/felix/ipojo/util/ServiceLocator.class
org/apache/felix/ipojo/util/ServiceReferenceRankingComparator.class
org/apache/felix/ipojo/util/StreamUtils.class
org/apache/felix/ipojo/util/SystemPropertiesSource.class
org/apache/felix/ipojo/util/Tracker$Tracked.class
org/apache/felix/ipojo/util/Tracker.class
org/objectweb/asm/AnnotationWriter.class
org/objectweb/asm/Attribute.class
org/objectweb/asm/ByteVector.class
org/objectweb/asm/ClassAdapter.class
org/objectweb/asm/ClassReader.class
org/objectweb/asm/ClassWriter.class
org/objectweb/asm/Edge.class
org/objectweb/asm/FieldWriter.class
org/objectweb/asm/Frame.class
org/objectweb/asm/Handler.class
org/objectweb/asm/Item.class
org/objectweb/asm/Label.class
org/objectweb/asm/MethodAdapter.class
org/objectweb/asm/MethodWriter.class
org/objectweb/asm/Type.class
org/objectweb/asm/commons/LocalVariablesSorter.class
org/objectweb/asm/commons/GeneratorAdapter.class
org/objectweb/asm/commons/AdviceAdapter.class
org/objectweb/asm/commons/AnalyzerAdapter.class
org/objectweb/asm/commons/CodeSizeEvaluator.class
org/objectweb/asm/commons/InstructionAdapter.class
org/objectweb/asm/commons/JSRInlinerAdapter$Instantiation.class
org/objectweb/asm/commons/JSRInlinerAdapter$Subroutine.class
org/objectweb/asm/commons/JSRInlinerAdapter.class
org/objectweb/asm/commons/Method.class
org/objectweb/asm/commons/Remapper.class
org/objectweb/asm/commons/RemappingAnnotationAdapter.class
org/objectweb/asm/commons/RemappingClassAdapter.class
org/objectweb/asm/commons/RemappingFieldAdapter.class
org/objectweb/asm/commons/RemappingMethodAdapter.class
org/objectweb/asm/commons/RemappingSignatureAdapter.class
org/objectweb/asm/commons/SerialVersionUIDAdder$Item.class
org/objectweb/asm/commons/SerialVersionUIDAdder.class
org/objectweb/asm/commons/SimpleRemapper.class
org/objectweb/asm/commons/StaticInitMerger.class
org/objectweb/asm/commons/TableSwitchGenerator.class
org/objectweb/asm/commons/TryCatchBlockSorter$1.class
org/objectweb/asm/commons/TryCatchBlockSorter.class
org/osgi/service/cm/Configuration.class
org/osgi/service/cm/ConfigurationAdmin.class
org/osgi/service/cm/ConfigurationEvent.class
org/osgi/service/cm/ConfigurationException.class
org/osgi/service/cm/ConfigurationPermission.class
org/osgi/service/cm/ConfigurationPermissionCollection$1.class
org/osgi/service/cm/ConfigurationPermissionCollection.class
org/osgi/service/cm/ConfigurationPlugin.class
org/osgi/service/cm/ManagedServiceFactory.class
org/osgi/service/log/LogEntry.class
org/osgi/service/log/LogListener.class
org/osgi/service/log/LogReaderService.class

然后dexing有警告,但ConsoleLogService没有警告。

dx --dex --output=./classes.dex ./org.apache.felix.ipojo-1.11.0.jar:

warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.osgi.service.cm.ConfigurationPermissionCollection$1) that doesn't come with
 an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
4

2 回答 2

1

问题来自于对类的重新定义。Dalvik 不支持让类定义两次(即使在两个不同的包或类加载器中)。这意味着您不能遵循通常使用的 OSGi 的良好实践规则:

  • 每个类必须定义一次且仅一次
  • 每个导出的包必须只定义一次(不管它的版本)

我想你有另一个包导出配置管理包或日志服务包(例如 OSGi 纲要,或这些服务的实现)。在这种情况下,您需要通过删除这些包以及包含的类的导出来稍微转换 iPOJO 包。如果可以自己打包 iPOJO,打开 pom 文件,删除:

<!-- Compendium packages -->
org.osgi.service.cm; version=1.3,
org.osgi.service.log; version=1.3
于 2013-11-16T07:31:24.967 回答
1

你“dex”了 iPOJO 捆绑包吗?看起来它找不到内部类。

于 2013-11-11T06:54:44.383 回答