Codenameone:在构建期间无法找到包

时间:2016-07-28 12:46:08

标签: codenameone

When I build my application I get following errors. Can you please let me know how to resolve it. My application needs to be supported on all platforms (Andriod, IOS, windows) and I don't want to write native code for all platforms separately. 

java:4: error: package java.lang.reflect does not exist
        import java.lang.reflect.UndeclaredThrowableException;
java:6: error: package javax.crypto does not exist
        import javax.crypto.Mac;
             ^
7: error: package javax.crypto.spec does not exist
       import javax.crypto.spec.SecretKeySpec;
java:48: error: cannot find symbol Mac hmac;
50: error: cannot find symbol
       [javac]              hmac = Mac.getInstance(crypto);

^     java:53:错误:找不到符号            [javac] SecretKeySpec macKey = ^            [javac] symbol:class SecretKeySpec            [javac] location:类TokenGenerator     java:55:错误:找不到符号            [javac] new SecretKeySpec(keyBytes,“RAW”);                          ^            [javac] symbol:class SecretKeySpec            [javac] location:类TokenGenerator     java:61:错误:找不到符号            [javac]} catch(GeneralSecurityException gse){            [javac] ^     java:63:错误:找不到符号            [javac]抛出新的UndeclaredThrowableException(gse);            [javac] ^     symbol:class UndeclaredThrowableException            [javac] location:class TokenGenerator

1 个答案:

答案 0 :(得分:1)

Codename One不支持这些软件包。反射不能以高效的方式在设备上实现,并且不应该被普遍使用,因为它与模糊处理相冲突,这是移动设备的推荐最佳实践。

Crypto是一个包含导出限制和反射依赖性的大型设计包。我们为bouncy castle提供了cn1lib扩展。