gradle-retrolambda
gradle-retrolambda copied to clipboard
problem when using with a library that uses java-8
A library I am using is switching to java-8 - so I thought I use retro-lambda to work around this. Unfortunately it does not seem to work.
* What went wrong:
Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/home/ligi/bin/android-sdk/build-tools/21.1.2/dx --dex --output /home/ligi/git/EtherDroid/app/build/intermediates/pre-dexed/debug/ethereumj-core-0.7.15-SNAPSHOT-e51b5aa0b29943dc2aab8890d25951d99dcee695.jar /home/ligi/.m2/repository/org/ethereum/ethereumj-core/0.7.15-SNAPSHOT/ethereumj-core-0.7.15-SNAPSHOT.jar
Error Code:
1
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.dx.command.dexer.Main.processClass(Main.java:704)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
at com.android.dx.command.dexer.Main.access$300(Main.java:83)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
...while parsing org/ethereum/Start.class
1 error; aborting
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
A bit more background here: https://github.com/ethereum/ethereumj/issues/184
I have the feeling that retro-lambda only works for classes that are in the project - not for ones coming from libraries. Is this correct? If so - is it possible to also work for the libraries used?
That is correct, it only works for your source code, all libraries must be java 6/7. In theory it could process libraries by scanning for java 8 jars, unpacking them, running them through retrolambda, packing them back up, then depending on the processed jar instead. However, none of this is implemented and would take a bit of work.
thanks for the fast information and your work in general!
Did the new plugin with transform api solve this problem? Will the transform be applied to the external jar files' .class files?