Android的嵌入式菲利克斯失踪的要求osgi.ee [英] Android embedded Felix missing requirement osgi.ee

查看:224
本文介绍了Android的嵌入式菲利克斯失踪的要求osgi.ee的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图说服在Android嵌入式Apache的菲利克斯启动外部包。结果
到目前为止,我已经成功地将felix.jar嵌入到自己的APK并运行它作为一项活动。在这个活动,我能够从jar文件安装外束。不幸的是,每当我试图移动并启动这些捆绑我收到以下错误之一:

I'm trying to convince an embedded Apache Felix on Android to start an external bundle.
So far I have managed to embed the felix.jar into its own APK and run it as an activity. Within this activity I'm able to install outside bundles from jar files. Unfortunately whenever I try to move on and start one of these bundles I get the following error:

遇到异常时启动包:

Unresolved constraint in bundle com.example.hellofelix [1]:        
Unable to resolve 1.0:             
missing requirement [1.0] osgi.ee;                           
(&(osgi.ee=JavaSE)(version=1.7.0))     

由于 com.example.hellofelix 是我的测试应用程序包名这表明我的应用程序是缺少由<$ C的约束要求的osgi.ee包$ C> JavaSE的1.7.0。

As com.example.hellofelix is the package name for my test application this suggests that my app is missing the osgi.ee package required by the constraint of JavaSE 1.7.0.

究竟我该怎么解决这个问题呢?结果
我一定要指定设有额外的出口在我的应用程序,进口的东西或者只是添加另一包?

How exactly do I solve this problem?
Do I have to specify en extra export in my app, import something or just add another bundle?

我的包的code:

激活:

package com.example.dictionary;

import java.util.Hashtable;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

import com.example.dictionary.service.DictionaryBundle;

public class Activator implements BundleActivator {

  public void start(BundleContext context) throws Exception {
    Hashtable<String, String> props = new Hashtable<String, String>();
    props.put("Language", "de-en");
    context.registerService(DictionaryBundle.class.getName(), new DictionaryBundleImpl(), props);
  }

  public void stop(BundleContext context) throws Exception {
    // NOTE: The service is automatically unregistered.
  }

} 

接口:

package com.example.dictionary.service;

public interface DictionaryBundle {

    public String translate(String wordToTranslate);

}

实施

package com.example.dictionary;

import java.util.Hashtable;

import com.example.dictionary.service.DictionaryBundle;

public class DictionaryBundleImpl implements DictionaryBundle {

    private Hashtable<String, String> dictionary;

    public DictionaryBundleImpl() {
        dictionary = new Hashtable<>();

        dictionary.put("ente", "duck");
        dictionary.put("hund", "dog");
        dictionary.put("kuh", "cow");
        dictionary.put("katze", "cat");
        dictionary.put("maus", "mouse");
    }

    public String translate(String wordToTranslate) {
        return dictionary.get(wordToTranslate);
    }

}

MANIFEST.MF:

MANIFEST.MF:

Manifest-Version: 1.0
Bundle-SymbolicName: com.example.hellofelix
Export-Package: com.example.dictionary.service
Bundle-Name: TestBundle
Bundle-Version: 1.4.2.qualifier
Bundle-ManifestVersion: 2
Bundle-Activator: com.example.dictionary.Activator
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Bundle-Vendor: None

非常感谢你!

推荐答案

该包的清单说,它需要的JavaSE 1.7。和你的运行不提供该JRE。因此,它未能解决,因为它应该。

The bundle's manifest says that it requires JavaSE 1.7. And your runtime does not supply that JRE. So it fails to resolve as it should.

您可以更改该包的目标不同osgi.ee(一个在Android)或你可以告诉菲利克斯说谎并声称,osgi.ee是JavaSE的1.7。

You can either change the bundle to target a different osgi.ee (the one in Android) or you can tell Felix to lie and claim that the osgi.ee is JavaSE 1.7.

也就是说,要么改变被捆绑的要求或框架提供的能力。

That is, either change the requirement in the bundle or the capability provided by the framework.

这篇关于Android的嵌入式菲利克斯失踪的要求osgi.ee的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆