Android中使用lambdajAndroid、lambdaj

2023-09-06 02:57:12 作者:流泪的天使

有没有人尝试过​​使用lambdaj库在Android开发?

它工作正常的我,当我创建一个简单的Java小应用程序,但我不能设法用它在Android应用程序。

更新:

我添加lambdaj(lambdaj-2.3.2-与-dependencies.jar,从的 HTTP://$c$c.google.com/p/lambdaj ),然后建筑物时,我的应用程序出现以下错误:

 霉素警告:忽略InnerClasses属性匿名内部类
(org.hamcrest.generator.qdox.directorywalker.DirectoryScanner $ 1)不来的
相关EnclosingMethod属性。这个类可能是由一个生产
编译器并没有针对现代.class文件格式。推荐
的解决方案是重新编译从源的类,使用最多的最新的编译器
并且不指定任何-target类型选项。忽视的后果
这个警告是在此类反射操作将不正确
表明它是*不*内部类。

[2011-05-12 15点45分30秒 -  MyAppName]霉素警告:忽略InnerClasses属性匿名内部类
(org.hamcrest.generator.qdox.JavaDocBuilder $ 1)不来的
相关EnclosingMethod属性。这个类可能是由一个生产
编译器并没有针对现代.class文件格式。推荐
的解决方案是重新编译从源的类,使用最多的最新的编译器
并且不指定任何-target类型选项。忽视的后果
这个警告是在此类反射操作将不正确
表明它是*不*内部类。

[2011-05-12 15点45分30秒 -  MyAppName]霉素警告:忽略InnerClasses属性匿名内部类
(org.hamcrest.generator.qdox.junit.APITestCase $ 1)不来的
相关EnclosingMethod属性。这个类可能是由一个生产
编译器并没有针对现代.class文件格式。推荐
的解决方案是重新编译从源的类,使用最多的最新的编译器
并且不指定任何-target类型选项。忽视的后果
这个警告是在此类反射操作将不正确
表明它是*不*内部类。

[2011-05-12 15点45分30秒 -  MyAppName]霉素
意外的顶级例外:
。com.android.dx.cf code.SimException:局部变量的类型不匹配:尝试设置或访问类型的值的java.lang.Object使用类型为int的局部变量。这是有症状的忽视局部变量信息的.class转换工具。

...
跳过堆栈跟踪
...

...当工作在块001B

...而工作方法yylex的:()我

...同时处理yylex的()我

...在处理组织/ hamcrest /发电机/ qdox /分析器/ IMPL / JFlexLexer.class

[2011-05-12 15点45分30秒 -  MyAppName]霉素1的错误;中止

[2011-05-12 15点45分30秒 -  MyAppName]转换为的Dalvik格式失败,错误1
 

解决方案

我知道这个问题是4岁,但我有同样的问题nowdays,我加入到我的摇篮构建配置解决depedencies最后hamcrest库版本可用。

here我的相关话题

更新:

我有一些问题的 lambdaj 的在我的项目,这个库是不完全兼容。我搬到的 retrolambda 的,检查出来!

Does anyone tried to use lambdaj library in android development?

Android开发太难了 Java Lambda Android Lambda

It works fine for me when I create a simple small java application, but I can't manage to use it in an android application.

UPDATE:

I'm adding lambdaj (lambdaj-2.3.2-with-dependencies.jar, downloaded from http://code.google.com/p/lambdaj), and then when building my application get the following error:

Dx warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.hamcrest.generator.qdox.directorywalker.DirectoryScanner$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.

[2011-05-12 15:45:30 - MyAppName] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.hamcrest.generator.qdox.JavaDocBuilder$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.

[2011-05-12 15:45:30 - MyAppName] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.hamcrest.generator.qdox.junit.APITestCase$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.

[2011-05-12 15:45:30 - MyAppName] Dx 
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.code.SimException: local variable type mismatch: attempt to set or access a value of type java.lang.Object using a local variable of type int. This is symptomatic of .class transformation tools that ignore local variable information.

...
skipped stack trace
...

...while working on block 001b

...while working on method yylex:()I

...while processing yylex ()I

...while processing org/hamcrest/generator/qdox/parser/impl/JFlexLexer.class

[2011-05-12 15:45:30 - MyAppName] Dx 1 error; aborting

[2011-05-12 15:45:30 - MyAppName] Conversion to Dalvik format failed with error 1

解决方案

I know that this question is 4 years old, but I had the same problem nowdays and I solved by adding to my gradle build configuration depedencies the last hamcrest library version available.

here my related thread

UPDATE:

I had some problem with lambdaj on my project, this library is not totally compatible. I moved to retrolambda, check it out!

 
精彩推荐
图片推荐