Codenameone 尝试调用代号为one的本机函数时,isSupported()始终返回false

Codenameone 尝试调用代号为one的本机函数时,isSupported()始终返回false,codenameone,Codenameone,我试图调用下面的sayHi()函数,该函数在NativeTestImpl.java中实现 这些是我的文件: NativeTest.java package com.mycompany.myapp; import com.codename1.system.NativeInterface; public interface NativeTest extends NativeInterface { public String sayHi(); } NativeTestImpl.jav

我试图调用下面的sayHi()函数,该函数在NativeTestImpl.java中实现

这些是我的文件:

NativeTest.java

package com.mycompany.myapp;

import com.codename1.system.NativeInterface;

public interface NativeTest extends NativeInterface {
    public String sayHi();  
}
NativeTestImpl.java

package com.mycompany.myapp;
public class NativeTestImpl implements com.mycompany.myapp.NativeTest {
    public String sayHi() {
        return "HI";
    }

    public boolean isSupported() {
        return true;
    }

}
MyApplication.java的start()方法:

 public void start() {
        if(current != null){
            current.show();
            return;
        }
        String s=null;
        try
        {
            NativeTest obj = (NativeTest)NativeLookup.create(NativeTest.class);
            if(obj != null && obj.isSupported())
            {
                s=obj.sayHi();
            }
            else
            {
                 System.out.println("Native interface is not supported on this platform");
            }
        }
        catch(Throwable t) {
            Dialog.show("Error", "Exception during native access: " + t, "OK", null);
        }

        final Form f = new Form("Testing");
        f.setScrollable(false);
        TextField text=new TextField(s);
        f.addComponent(text);
        f.show();
    }

问题是,当我在带有nexus皮肤的模拟器上运行obj.isSupported()时,它返回false。我在调试模式下运行它,发现obj不是null。只有obj.isSupported()函数调用返回false,因此它将进入else部分

我假设您没有在native/javase目录下实现模拟器本机接口

好的,这就是问题所在。谢谢我在我的安卓设备上运行了它,它正在工作,所以我想这可能是模拟器本机代码的一些问题。